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

Function new_thread_invoke

src/builtin/module_builtin_jobque.cpp:639–659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

637 }
638
639 void new_thread_invoke ( Lambda lambda, Func fn, int32_t lambdaSize, Context * context, LineInfoArg * lineinfo ) {
640 shared_ptr<Context> forkContext;
641 forkContext.reset(get_clone_context(context, uint32_t(ContextCategory::thread_clone)));
642 forkContext->sharedPtrContext = true;
643 auto ptr = forkContext->allocate(lambdaSize + 16,lineinfo);
644 forkContext->heap->mark_comment(ptr, "new [[ ]] in new_thread");
645 memset ( ptr, 0, lambdaSize + 16 );
646 ptr += 16;
647 das_invoke_function<void>::invoke(forkContext.get(), lineinfo, fn, ptr, lambda.capture);
648 das_delete<Lambda>::clear(context, lambda);
649 g_jobQueTotalThreads ++;
650 auto bound = daScriptEnvironment::getBound();
651 thread([=]() mutable {
652 daScriptEnvironment::setBound(bound);
653 Lambda flambda(ptr);
654 das_invoke_lambda<void>::invoke(forkContext.get(), lineinfo, flambda);
655 das_delete<Lambda>::clear(forkContext.get(), flambda);
656 g_jobQueTotalThreads --;
657 shutdownThreadLocalDebugAgent();
658 }).detach();
659 }
660
661 extern condition_variable debugger_stopped;
662 extern atomic<bool> debugger_started;

Callers

nothing calls this directly

Calls 7

get_clone_contextFunction · 0.85
invokeFunction · 0.50
clearFunction · 0.50
resetMethod · 0.45
allocateMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected