Elijah Newren | 4f6728d | 2023-03-21 06:25:56 +0000 | [diff] [blame] | 1 | #include "git-compat-util.h" |
Jeff Hostetler | 59c7b88 | 2021-03-15 21:08:23 +0000 | [diff] [blame] | 2 | #include "simple-ipc.h" |
| 3 | #include "strbuf.h" |
| 4 | #include "pkt-line.h" |
| 5 | #include "thread-utils.h" |
| 6 | |
Jeff Hostetler | 6aac70a | 2021-05-20 18:28:10 +0000 | [diff] [blame] | 7 | #ifndef SUPPORTS_SIMPLE_IPC |
| 8 | /* |
| 9 | * This source file should only be compiled when Simple IPC is supported. |
| 10 | * See the top-level Makefile. |
| 11 | */ |
| 12 | #error SUPPORTS_SIMPLE_IPC not defined |
| 13 | #endif |
Jeff Hostetler | 59c7b88 | 2021-03-15 21:08:23 +0000 | [diff] [blame] | 14 | |
| 15 | int ipc_server_run(const char *path, const struct ipc_server_opts *opts, |
| 16 | ipc_server_application_cb *application_cb, |
| 17 | void *application_data) |
| 18 | { |
| 19 | struct ipc_server_data *server_data = NULL; |
| 20 | int ret; |
| 21 | |
| 22 | ret = ipc_server_run_async(&server_data, path, opts, |
| 23 | application_cb, application_data); |
| 24 | if (ret) |
| 25 | return ret; |
| 26 | |
| 27 | ret = ipc_server_await(server_data); |
| 28 | |
| 29 | ipc_server_free(server_data); |
| 30 | |
| 31 | return ret; |
| 32 | } |