| 104 | } |
| 105 | |
| 106 | void TimerImpl::stop() |
| 107 | { |
| 108 | MutexLockGuard guard(m_mutex, FB_FUNCTION); |
| 109 | |
| 110 | // Allow handler() to call stop() |
| 111 | if (m_handlerTid == Thread::getCurrentThreadId()) |
| 112 | return; |
| 113 | |
| 114 | // hvlad: it could be replaced by condition variable when we have good one for Windows |
| 115 | while (m_handlerTid) |
| 116 | { |
| 117 | MutexUnlockGuard unlock(m_mutex, FB_FUNCTION); |
| 118 | Thread::sleep(10); |
| 119 | } |
| 120 | |
| 121 | if (!m_fireTime) |
| 122 | return; |
| 123 | |
| 124 | m_fireTime = m_expTime = 0; |
| 125 | |
| 126 | LocalStatus ls; |
| 127 | CheckStatusWrapper s(&ls); |
| 128 | |
| 129 | ITimerControl* timerCtrl = TimerInterfacePtr(); |
| 130 | timerCtrl->stop(&s, this); |
| 131 | check(&s); |
| 132 | } |
| 133 | |
| 134 | } // namespace Firebird |
no test coverage detected