feat: add C & Zig bindings for unix acceptor and connector

This commit is contained in:
CJ van den Berg 2026-03-02 18:43:49 +00:00
parent 628e990f6e
commit ed91a28f5f
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
9 changed files with 283 additions and 0 deletions

View file

@ -111,6 +111,7 @@ extern "C" auto runtestcase(const char *name) -> int {
tests["perf_spawn"] = perf_spawn;
tests["spawn_exit"] = spawn_exit;
tests["timeout_test"] = timeout_test;
tests["unx_c_api"] = unx_c_api;
env_t env{};
env_t log_env{};

View file

@ -27,3 +27,4 @@ testcase perf_ring;
testcase perf_spawn;
testcase spawn_exit;
testcase timeout_test;
testcase unx_c_api;

25
test/unx_c_api.cpp Normal file
View file

@ -0,0 +1,25 @@
#include "tests.hpp"
#include <thespian/c/unx.h>
using namespace thespian;
// Very small smoke test for the new C API. We don't actually open sockets,
// just verify that the create/destroy functions work and return non-null.
auto unx_c_api(thespian::context &ctx, bool &result, thespian::env_t env)
-> thespian::result {
(void)ctx;
(void)env;
struct thespian_unx_acceptor_handle *a = thespian_unx_acceptor_create("tag");
check(a != nullptr);
thespian_unx_acceptor_destroy(a);
struct thespian_unx_connector_handle *c =
thespian_unx_connector_create("tag");
check(c != nullptr);
thespian_unx_connector_destroy(c);
result = true;
return ok();
}