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

Function add_trigger

lib/cpp/test/TransportTest.cpp:421–441  ·  view source on GitHub ↗

* Add a trigger to be scheduled "seconds" seconds after the * last currently scheduled trigger. * * (Note that this is not "seconds" from now. That might be more logical, but * would require slightly more complicated sorting, rather than just appending * to the end.) */

Source from the content-addressed store, hash-verified

419 * to the end.)
420 */
421void add_trigger(unsigned int seconds,
422 const std::shared_ptr<TTransport>& transport,
423 uint32_t write_len) {
424 auto* info = new TriggerInfo(seconds, transport, write_len);
425 {
426 apache::thrift::concurrency::Synchronized s(g_alarm_monitor);
427 if (g_triggerInfo == nullptr) {
428 // This is the first trigger.
429 // Set g_triggerInfo, and schedule the alarm
430 g_triggerInfo = info;
431 g_alarm_monitor.notify();
432 } else {
433 // Add this trigger to the end of the list
434 TriggerInfo* prev = g_triggerInfo;
435 while (prev->next) {
436 prev = prev->next;
437 }
438 prev->next = info;
439 }
440 }
441}
442
443void clear_triggers() {
444 TriggerInfo* info = nullptr;

Callers 2

set_triggerFunction · 0.85
test_read_none_availableFunction · 0.85

Calls 1

notifyMethod · 0.45

Tested by

no test coverage detected