MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / part_a_worker

Function part_a_worker

tutorials/integration/c/10_threading.c:80–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78static unsigned __stdcall part_a_worker(void * raw)
79#else
80static void * part_a_worker(void * raw)
81#endif
82{
83 part_a_args * args = (part_a_args *)raw;
84
85 // Bind the main thread's environment on this worker thread.
86 das_environment_set_bound(args->env);
87
88 // Look up the function in the *cloned* context.
89 das_function * fn = das_context_find_function(args->ctx, "compute");
90 if (fn) {
91 vec4f res = das_context_eval_with_catch(args->ctx, fn, NULL);
92 args->result = das_argument_int(res);
93 }
94
95#ifdef _WIN32
96 return 0;
97#else
98 return NULL;
99#endif
100}
101
102static void part_a_run_on_thread(void) {
103 printf("=== Part A: Run on a worker thread ===\n");

Callers

nothing calls this directly

Calls 4

das_argument_intFunction · 0.85

Tested by

no test coverage detected