MCPcopy Create free account
hub / github.com/Codesire-Deng/co_context / workerThread

Function workerThread

example/sem_std.cpp:80–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78std::array<Guide, max_threads> guides;
79
80void workerThread(unsigned id) {
81 guides[id].initial_delay(); // emulate some work before sema acquisition
82 sem.acquire(); // wait until a free sema slot is available
83 guides[id].occupy_sema(); // emulate some work while sema is acquired
84 sem.release();
85 guides[id].visualize(id);
86}
87
88int main() {
89 std::vector<std::thread> threads;

Callers

nothing calls this directly

Calls 5

initial_delayMethod · 0.45
acquireMethod · 0.45
occupy_semaMethod · 0.45
releaseMethod · 0.45
visualizeMethod · 0.45

Tested by

no test coverage detected