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

Function bthread_self

src/bthread/bthread.cpp:384–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384bthread_t bthread_self(void) {
385 bthread::TaskGroup* g = bthread::tls_task_group;
386 // note: return 0 for main tasks now, which include main thread and
387 // all work threads. So that we can identify main tasks from logs
388 // more easily. This is probably questionable in the future.
389 if (g != NULL && !g->is_current_main_task()/*note*/) {
390 return g->current_tid();
391 }
392 return INVALID_BTHREAD;
393}
394
395int bthread_equal(bthread_t t1, bthread_t t2) {
396 return t1 == t2;

Callers 15

RunThreadFuncFunction · 0.85
worker1_implFunction · 0.85
produce_funcFunction · 0.85
consume_funcFunction · 0.85
waiterFunction · 0.85
SendDataMethod · 0.85
TEST_FFunction · 0.85
show_selfFunction · 0.85
join_selfFunction · 0.85
check_sleepFunction · 0.85

Calls 2

is_current_main_taskMethod · 0.80
current_tidMethod · 0.80

Tested by 11

worker1_implFunction · 0.68
produce_funcFunction · 0.68
consume_funcFunction · 0.68
waiterFunction · 0.68
SendDataMethod · 0.68
TEST_FFunction · 0.68
show_selfFunction · 0.68
join_selfFunction · 0.68
check_sleepFunction · 0.68
joinerFunction · 0.68
waiterFunction · 0.68