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

Function pop_thread

test/bthread_work_stealing_queue_unittest.cpp:69–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69void* pop_thread(void* arg) {
70 std::vector<value_type> *popped = new std::vector<value_type>;
71 popped->reserve(N);
72 bthread::WorkStealingQueue<value_type> *q =
73 (bthread::WorkStealingQueue<value_type>*)arg;
74 while (!g_stop) {
75 value_type val;
76 pthread_mutex_lock(&mutex);
77 const bool res = q->pop(&val);
78 pthread_mutex_unlock(&mutex);
79 if (res) {
80 popped->push_back(val);
81 }
82 }
83 return popped;
84}
85
86
87TEST(WSQTest, sanity) {

Callers

nothing calls this directly

Calls 5

pthread_mutex_lockFunction · 0.85
pthread_mutex_unlockFunction · 0.85
reserveMethod · 0.45
popMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected