MCPcopy Create free account
hub / github.com/chen3feng/toft / GetPendingTask

Method GetPendingTask

system/threading/thread_pool.cpp:44–52  ·  view source on GitHub ↗

Return whether should exit. Note even if return false, the task may be not empty because of remaining tasks before exit was set.

Source from the content-addressed store, hash-verified

42// Return whether should exit. Note even if return false, the task may be not
43// empty because of remaining tasks before exit was set.
44bool ThreadPool::ThreadContext::GetPendingTask(TaskList* tasks) {
45 MutexLocker locker(&mutex);
46 free_tasks.splice(*tasks);
47 while (pending_tasks.empty() && !exit) {
48 cond.Wait();
49 }
50 tasks->splice(pending_tasks);
51 return !exit;
52}
53
54ThreadPool::ThreadPool(int num_threads):
55 m_num_threads(0), m_num_busy_threads(0), m_exit_cond(&m_exit_lock), m_exit(false) {

Callers 1

WorkRoutineMethod · 0.80

Calls 3

spliceMethod · 0.80
emptyMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected