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

Function bthread_getspecific

src/bthread/key.cpp:650–666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648}
649
650void* bthread_getspecific(bthread_key_t key) {
651 bthread::KeyTable* kt = bthread::tls_bls.keytable;
652 if (kt) {
653 return kt->get_data(key);
654 }
655 bthread::TaskGroup* const g = bthread::BAIDU_GET_VOLATILE_THREAD_LOCAL(tls_task_group);
656 if (g) {
657 bthread::TaskMeta* const task = g->current_task();
658 kt = bthread::borrow_keytable(task->attr.keytable_pool);
659 if (kt) {
660 g->current_task()->local_storage.keytable = kt;
661 bthread::tls_bls.keytable = kt;
662 return kt->get_data(key);
663 }
664 }
665 return NULL;
666}
667
668void bthread_assign_data(void* data) {
669 bthread::tls_bls.assigned_data = data;

Callers 13

EchoMethod · 0.85
worker1_implFunction · 0.85
worker2_implFunction · 0.85
use_invalid_keys_implFunction · 0.85
TESTFunction · 0.85
sid_dtorFunction · 0.85
set_before_anybth_implFunction · 0.85
pool_thread_implFunction · 0.85
pool_dtorFunction · 0.85
usleep_thread_implFunction · 0.85
lid_worker_implFunction · 0.85
thread_local_dataFunction · 0.85

Calls 2

borrow_keytableFunction · 0.85
current_taskMethod · 0.80

Tested by 10

worker1_implFunction · 0.68
worker2_implFunction · 0.68
use_invalid_keys_implFunction · 0.68
TESTFunction · 0.68
sid_dtorFunction · 0.68
set_before_anybth_implFunction · 0.68
pool_thread_implFunction · 0.68
pool_dtorFunction · 0.68
usleep_thread_implFunction · 0.68
lid_worker_implFunction · 0.68