| 7407 | } |
| 7408 | |
| 7409 | void Worker::shutdown() |
| 7410 | { |
| 7411 | MutexLockGuard guard(m_mutex, FB_FUNCTION); |
| 7412 | if (shutting_down) |
| 7413 | { |
| 7414 | return; |
| 7415 | } |
| 7416 | |
| 7417 | shutting_down = true; |
| 7418 | |
| 7419 | while (getCount()) |
| 7420 | { |
| 7421 | wakeUpAll(); |
| 7422 | m_mutex->leave(); // we need CheckoutGuard here |
| 7423 | try |
| 7424 | { |
| 7425 | Thread::sleep(100); |
| 7426 | } |
| 7427 | catch (const Exception&) |
| 7428 | { |
| 7429 | m_mutex->enter(FB_FUNCTION); |
| 7430 | throw; |
| 7431 | } |
| 7432 | m_mutex->enter(FB_FUNCTION); |
| 7433 | } |
| 7434 | } |
| 7435 | |
| 7436 | static int shut_server(const int, const int, void*) |
| 7437 | { |