MCPcopy Create free account
hub / github.com/apple/foundationdb / run

Method run

fdbclient/AsyncTaskThread.actor.cpp:77–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77void AsyncTaskThread::run(AsyncTaskThread* self) {
78 while (true) {
79 std::unique_ptr<IAsyncTask> task;
80 {
81 std::unique_lock<std::mutex> lk(self->m);
82 self->cv.wait(lk, [self] { return !self->queue.canSleep(); });
83 task = self->queue.pop().get();
84 if (task->isTerminate()) {
85 return;
86 }
87 }
88 (*task)();
89 }
90}
91
92TEST_CASE("/asynctaskthread/add") {
93 state std::atomic<int> sum = 0;

Callers

nothing calls this directly

Calls 5

canSleepMethod · 0.80
getMethod · 0.65
waitMethod · 0.45
popMethod · 0.45
isTerminateMethod · 0.45

Tested by

no test coverage detected