| 316 | } |
| 317 | |
| 318 | void Coordinator::releaseThread(WorkerThread* thd) |
| 319 | { |
| 320 | MutexLockGuard guard(m_mutex, FB_FUNCTION); |
| 321 | |
| 322 | const WorkerThread::STATE thdState = thd->getState(); |
| 323 | if (thdState != WorkerThread::IDLE) |
| 324 | { |
| 325 | fb_assert(thdState == WorkerThread::STOPPING || thdState == WorkerThread::SHUTDOWN); |
| 326 | return; |
| 327 | } |
| 328 | |
| 329 | FB_SIZE_T pos; |
| 330 | if (m_activeThreads.find(thd, pos)) |
| 331 | { |
| 332 | m_activeThreads.remove(pos); |
| 333 | m_idleThreads.push(thd); |
| 334 | } |
| 335 | else |
| 336 | { |
| 337 | fb_assert(false); |
| 338 | |
| 339 | if (!m_idleThreads.find(thd, pos)) |
| 340 | m_idleThreads.push(thd); |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | |
| 345 | } // namespace Jrd |