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

Function setThreadAffinity

Disruptor/ThreadHelper_Linux.cpp:32–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30 }
31
32 bool setThreadAffinity(const AffinityMask& mask)
33 {
34 cpu_set_t cpuSet;
35 CPU_ZERO(&cpuSet);
36
37 for (size_t i = 0; i < mask.size(); ++i)
38 {
39 if (mask.test(i))
40 CPU_SET(i, &cpuSet);
41 }
42
43 return pthread_setaffinity_np(pthread_self(), sizeof(cpuSet), &cpuSet) == 0;
44 }
45
46 AffinityMask getThreadAffinity()
47 {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected