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

Function set_before_anybth_impl

test/bthread_key_unittest.cpp:322–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320void* set_before_anybth(void* args);
321
322void set_before_anybth_impl(SBAData* data) {
323 ASSERT_EQ(NULL, bthread_getspecific(data->key));
324 SBATLS *tls = new SBATLS;
325 tls->ndestroy = &data->ndestroy;
326 ASSERT_EQ(0, bthread_setspecific(data->key, tls));
327 ASSERT_EQ(tls, bthread_getspecific(data->key));
328 if (data->level++ == 0) {
329 bthread_t bth;
330 ASSERT_EQ(0, bthread_start_urgent(&bth, NULL, set_before_anybth, data));
331 ASSERT_EQ(0, bthread_join(bth, NULL));
332 ASSERT_EQ(1, data->ndestroy);
333 } else {
334 bthread_usleep(1000);
335 }
336 ASSERT_EQ(tls, bthread_getspecific(data->key));
337}
338
339void* set_before_anybth(void* args) {
340 set_before_anybth_impl((SBAData*)args);

Callers 1

set_before_anybthFunction · 0.85

Calls 5

bthread_getspecificFunction · 0.85
bthread_setspecificFunction · 0.85
bthread_start_urgentFunction · 0.85
bthread_joinFunction · 0.85
bthread_usleepFunction · 0.85

Tested by

no test coverage detected