MCPcopy Create free account
hub / github.com/Abc-Arbitrage/Disruptor-cpp / workingLoop

Method workingLoop

Disruptor/RoundRobinThreadAffinedTaskScheduler.cpp:54–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52 }
53
54 void RoundRobinThreadAffinedTaskScheduler::workingLoop(std::int32_t threadId)
55 {
56 static const auto processorCount = std::thread::hardware_concurrency();
57
58 const auto processorIndex = threadId % processorCount;
59
60 const auto affinityMask = ThreadHelper::AffinityMask(1ull << processorIndex);
61
62 ThreadHelper::setThreadAffinity(affinityMask);
63
64 while (m_started)
65 {
66 std::packaged_task< void() > task;
67 while (m_tasks.timedWaitAndPop(task, std::chrono::milliseconds(100)))
68 {
69 tryExecuteTask(task);
70 }
71 }
72 }
73
74 void RoundRobinThreadAffinedTaskScheduler::tryExecuteTask(std::packaged_task< void() >& task)
75 {

Callers

nothing calls this directly

Calls 2

timedWaitAndPopMethod · 0.80
setThreadAffinityFunction · 0.70

Tested by

no test coverage detected