MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_thread_create

Function cbm_thread_create

src/foundation/compat_thread.c:127–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127int cbm_thread_create(cbm_thread_t *t, size_t stack_size, void *(*fn)(void *), void *arg) {
128 if (stack_size == 0) {
129 stack_size = cbm_thread_default_stack_size();
130 } else {
131 stack_size = cbm_thread_stack_floor(stack_size);
132 }
133 win_thread_arg_t *a = (win_thread_arg_t *)malloc(sizeof(win_thread_arg_t));
134 if (!a) {
135 return CBM_NOT_FOUND;
136 }
137 a->fn = fn;
138 a->arg = arg;
139 t->handle = CreateThread(NULL, stack_size, win_thread_wrapper, a, 0, NULL);
140 if (!t->handle) {
141 free(a);
142 return CBM_NOT_FOUND;
143 }
144 return 0;
145}
146
147int cbm_thread_join(cbm_thread_t *t) {
148 if (WaitForSingleObject(t->handle, INFINITE) != WAIT_OBJECT_0) {

Calls 2

cbm_thread_stack_floorFunction · 0.85

Tested by 3

frontend_eof_child_runFunction · 0.68
th_server_thread_startFunction · 0.68