| 387 | } |
| 388 | |
| 389 | void alarm_handler_wrapper() { |
| 390 | int64_t timeout = 0; // timeout of 0 means wait forever |
| 391 | while (true) { |
| 392 | bool fireHandler = false; |
| 393 | { |
| 394 | apache::thrift::concurrency::Synchronized s(g_alarm_monitor); |
| 395 | if (g_teardown) |
| 396 | return; |
| 397 | // calculate timeout |
| 398 | if (g_triggerInfo == nullptr) { |
| 399 | timeout = 0; |
| 400 | } else { |
| 401 | timeout = g_triggerInfo->timeoutSeconds * 1000; |
| 402 | } |
| 403 | |
| 404 | int waitResult = g_alarm_monitor.waitForTimeRelative(timeout); |
| 405 | if (waitResult == THRIFT_ETIMEDOUT) |
| 406 | fireHandler = true; |
| 407 | } |
| 408 | if (fireHandler) |
| 409 | alarm_handler(); // calling outside the lock |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | /** |
| 414 | * Add a trigger to be scheduled "seconds" seconds after the |
nothing calls this directly
no test coverage detected