ITimerControl implementation
| 328 | public: |
| 329 | // ITimerControl implementation |
| 330 | void start(CheckStatusWrapper* status, ITimer* timer, ISC_UINT64 microSeconds) |
| 331 | { |
| 332 | try |
| 333 | { |
| 334 | MutexLockGuard guard(timerAccess, FB_FUNCTION); |
| 335 | |
| 336 | if (stopTimerThread.value() != 0) |
| 337 | { |
| 338 | // Ignore an attempt to start timer - anyway thread to make it fire is down |
| 339 | |
| 340 | // We must leave timerAccess mutex here to avoid deadlocks |
| 341 | MutexUnlockGuard ug(timerAccess, FB_FUNCTION); |
| 342 | |
| 343 | timer->addRef(); |
| 344 | timer->release(); |
| 345 | return; |
| 346 | } |
| 347 | |
| 348 | timerHolder.init(); |
| 349 | |
| 350 | TimerEntry* curTimer = getTimer(timer); |
| 351 | if (curTimer) |
| 352 | timerQueue->remove(curTimer); |
| 353 | else |
| 354 | timer->addRef(); |
| 355 | |
| 356 | TimerEntry newTimer; |
| 357 | newTimer.timer = timer; |
| 358 | newTimer.fireTime = curTime() + microSeconds; |
| 359 | timerQueue->add(newTimer); |
| 360 | |
| 361 | timerWakeup->release(); |
| 362 | } |
| 363 | catch (const Firebird::Exception& ex) |
| 364 | { |
| 365 | ex.stuffException(status); |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | void stop(CheckStatusWrapper* status, ITimer* timer) |
| 370 | { |