MCPcopy Create free account
hub / github.com/defold/defold / JobSystemDestroy

Function JobSystemDestroy

engine/dlib/src/dlib/jobsystem.cpp:662–693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

660}
661
662void JobSystemDestroy(HJobContext context)
663{
664 if (!context)
665 return;
666
667 dmAtomicDecrement32(&context->m_Initialized); // accept no more jobs
668
669 CancelAllJobs(context);
670
671#if defined(DM_HAS_THREADS)
672 if (context->m_UseThreads)
673 {
674 {
675 DM_MUTEX_SCOPED_LOCK(context->m_ThreadContext.m_Mutex);
676
677 context->m_ThreadContext.m_Run = false;
678
679 dmConditionVariable::Broadcast(context->m_ThreadContext.m_WakeupCond);
680 }
681
682 for (int i = 0; i < context->m_Threads.Size(); ++i)
683 {
684 dmThread::Join(context->m_Threads[i]);
685 }
686
687 dmConditionVariable::Delete(context->m_ThreadContext.m_WakeupCond);
688 dmMutex::Delete(context->m_ThreadContext.m_Mutex);
689 }
690#endif // DM_HAS_THREADS
691
692 delete context;
693}
694
695
696uint32_t JobSystemGetWorkerCount(HJobContext context)

Callers 8

FinalizeFunction · 0.85
TearDownMethod · 0.85
TearDownMethod · 0.85
TearDownMethod · 0.85
TearDownMethod · 0.85
TearDownMethod · 0.85
TearDownMethod · 0.85
EngineDestroyFunction · 0.85

Calls 6

dmAtomicDecrement32Function · 0.85
CancelAllJobsFunction · 0.85
BroadcastFunction · 0.70
JoinFunction · 0.70
DeleteFunction · 0.70
SizeMethod · 0.45

Tested by 7

TearDownMethod · 0.68
TearDownMethod · 0.68
TearDownMethod · 0.68
TearDownMethod · 0.68
TearDownMethod · 0.68
TearDownMethod · 0.68
EngineDestroyFunction · 0.68