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

Function setThreadAffinity

Disruptor/ThreadHelper_macOS.cpp:102–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100 }
101
102 bool setThreadAffinity(const AffinityMask& mask)
103 {
104 cpu_set_t cpuSet;
105 CPU_ZERO(&cpuSet);
106
107 for (size_t i = 0; i < mask.size(); ++i)
108 {
109 if (mask.test(i))
110 CPU_SET(i, &cpuSet);
111 }
112
113 return pthread_setaffinity_np(pthread_self(), sizeof(cpuSet), &cpuSet) == 0;
114 }
115
116 AffinityMask getThreadAffinity()
117 {

Callers 1

workingLoopMethod · 0.70

Calls 4

CPU_ZEROFunction · 0.85
CPU_SETFunction · 0.85
pthread_setaffinity_npFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected