| 104 | } |
| 105 | |
| 106 | void ThreadAffinity::set(int threadIndex) |
| 107 | { |
| 108 | if (threadIndex >= (int)affinities.size()) |
| 109 | return; |
| 110 | |
| 111 | // Save the current affinity and set the new one |
| 112 | const HANDLE thread = GetCurrentThread(); |
| 113 | if (!pSetThreadGroupAffinity(thread, &affinities[threadIndex], &oldAffinities[threadIndex])) |
| 114 | printWarning("SetThreadGroupAffinity failed"); |
| 115 | } |
| 116 | |
| 117 | void ThreadAffinity::restore(int threadIndex) |
| 118 | { |