MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / getWork

Method getWork

extlibs/soloud/src/core/soloud_thread.cpp:294–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292 }
293
294 PoolTask * Pool::getWork()
295 {
296 PoolTask *t = 0;
297 if (mWorkMutex) lockMutex(mWorkMutex);
298 if (mMaxTask > 0)
299 {
300 int r = mRobin % mMaxTask;
301 mRobin++;
302 t = mTaskArray[r];
303 mTaskArray[r] = mTaskArray[mMaxTask - 1];
304 mMaxTask--;
305 }
306 if (mWorkMutex) unlockMutex(mWorkMutex);
307 return t;
308 }
309 }
310}

Callers 1

poolWorkerFunction · 0.80

Calls 2

lockMutexFunction · 0.85
unlockMutexFunction · 0.85

Tested by

no test coverage detected