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

Function cbm_thread_create

src/foundation/compat_thread.c:126–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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