MCPcopy Create free account
hub / github.com/beefytech/Beef / Shutdown

Method Shutdown

BeefySysLib/util/ThreadPool.cpp:100–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void ThreadPool::Shutdown()
101{
102 mShuttingDown = true;
103 mEvent.Set(true);
104
105 while (true)
106 {
107 Thread* thread = NULL;
108 //
109 {
110 AutoCrit autoCrit(mCritSect);
111 if (mThreads.IsEmpty())
112 break;
113 thread = mThreads.back();
114 mThreads.pop_back();
115 }
116
117 if (!BfpThread_WaitFor(thread->mBfpThread, -1))
118 break;
119
120 AutoCrit autoCrit(mCritSect);
121 delete thread;
122 mRunningThreads--;
123 }
124
125 BF_ASSERT(mRunningThreads == 0);
126
127 for (auto job : mJobs)
128 delete job;
129 mJobs.Clear();
130}
131
132void ThreadPool::SetStackSize(int stackSize)
133{

Callers

nothing calls this directly

Calls 6

BfpThread_WaitForFunction · 0.50
SetMethod · 0.45
IsEmptyMethod · 0.45
backMethod · 0.45
pop_backMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected