| 112 | |
| 113 | |
| 114 | void ThreadPool::PoolThreadLoop() |
| 115 | { |
| 116 | QueueEntry Task; |
| 117 | while (GetQueuedTask(&Task)) |
| 118 | { |
| 119 | Task.Proc(Task.Param); |
| 120 | |
| 121 | CriticalSectionStart(&CritSection); |
| 122 | if (--ActiveThreads == 0) |
| 123 | { |
| 124 | #ifdef _WIN_ALL |
| 125 | SetEvent(NoneActive); |
| 126 | #elif defined(_UNIX) |
| 127 | pthread_mutex_lock(&AnyActiveMutex); |
| 128 | AnyActive=false; |
| 129 | pthread_cond_signal(&AnyActiveCond); |
| 130 | pthread_mutex_unlock(&AnyActiveMutex); |
| 131 | #endif |
| 132 | } |
| 133 | CriticalSectionEnd(&CritSection); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | |
| 138 | bool ThreadPool::GetQueuedTask(QueueEntry *Task) |
no test coverage detected