| 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 | { |
nothing calls this directly
no test coverage detected