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

Function push_thread

test/bthread_work_stealing_queue_unittest.cpp:49–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void* push_thread(void* arg) {
50 size_t npushed = 0;
51 value_type seed = 0;
52 bthread::WorkStealingQueue<value_type> *q =
53 (bthread::WorkStealingQueue<value_type>*)arg;
54 while (true) {
55 pthread_mutex_lock(&mutex);
56 const bool pushed = q->push(seed);
57 pthread_mutex_unlock(&mutex);
58 if (pushed) {
59 ++seed;
60 if (++npushed == N) {
61 g_stop = true;
62 break;
63 }
64 }
65 }
66 return NULL;
67}
68
69void* pop_thread(void* arg) {
70 std::vector<value_type> *popped = new std::vector<value_type>;

Callers

nothing calls this directly

Calls 3

pthread_mutex_lockFunction · 0.85
pthread_mutex_unlockFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected