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

Function push_thread

test/bthread_execution_queue_unittest.cpp:162–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160};
161
162void* push_thread(void *arg) {
163 PushArg* pa = (PushArg*)arg;
164 int64_t sum = 0;
165 butil::Timer timer;
166 timer.start();
167 int num = 0;
168 bthread::CountdownEvent e;
169 LongIntTask t(num, pa->wait_task_completed ? &e : NULL);
170 if (pa->wait_task_completed) {
171 e.reset(1);
172 }
173 while (bthread::execution_queue_execute(pa->id, t) == 0) {
174 sum += num;
175 t.value = ++num;
176 if (pa->wait_task_completed) {
177 e.wait();
178 e.reset(1);
179 }
180 }
181 timer.stop();
182 pa->expected_value.fetch_add(sum, butil::memory_order_relaxed);
183 pa->total_num.fetch_add(num);
184 pa->total_time.fetch_add(timer.n_elapsed());
185 return NULL;
186}
187
188void* push_thread_which_addresses_execq(void *arg) {
189 PushArg* pa = (PushArg*)arg;

Callers

nothing calls this directly

Calls 7

execution_queue_executeFunction · 0.85
fetch_addMethod · 0.80
n_elapsedMethod · 0.80
startMethod · 0.45
resetMethod · 0.45
waitMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected