MCPcopy Create free account
hub / github.com/apache/thrift / alarm_handler_wrapper

Function alarm_handler_wrapper

lib/cpp/test/TransportTest.cpp:389–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389void 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

Callers

nothing calls this directly

Calls 2

alarm_handlerFunction · 0.85
waitForTimeRelativeMethod · 0.45

Tested by

no test coverage detected