MCPcopy Create free account
hub / github.com/apache/brpc / bthread_timer_add

Function bthread_timer_add

src/bthread/bthread.cpp:525–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525int bthread_timer_add(bthread_timer_t* id, timespec abstime,
526 void (*on_timer)(void*), void* arg) {
527 bthread::TaskControl* c = bthread::get_or_new_task_control();
528 if (c == NULL) {
529 return ENOMEM;
530 }
531 bthread::TimerThread* tt = bthread::get_or_create_global_timer_thread();
532 if (tt == NULL) {
533 return ENOMEM;
534 }
535 bthread_timer_t tmp = tt->schedule(on_timer, arg, abstime);
536 if (tmp != 0) {
537 *id = tmp;
538 return 0;
539 }
540 return ESTOP;
541}
542
543int bthread_timer_del(bthread_timer_t id) {
544 bthread::TaskControl* c = bthread::get_task_control();

Callers 9

WaitMethod · 0.85
StartIdleTimerMethod · 0.85
usleepMethod · 0.85
OnSubStreamStopMethod · 0.85
CallMethodMethod · 0.85
CallMethodMethod · 0.85
StartTaskAtMethod · 0.85
ConnectMethod · 0.85

Calls 3

get_or_new_task_controlFunction · 0.85
scheduleMethod · 0.45

Tested by

no test coverage detected