Fixes for OS X.
This commit is contained in:
parent
555eee8236
commit
faf14f5e5a
3 changed files with 5 additions and 16 deletions
|
@ -42,18 +42,4 @@ void Cpu::init()
|
|||
|
||||
void Cpu::setAffinity(int id, unsigned long mask)
|
||||
{
|
||||
cpu_set_t set;
|
||||
CPU_ZERO(&set);
|
||||
|
||||
for (int i = 0; i < m_totalThreads; i++) {
|
||||
if (mask & (1UL << i)) {
|
||||
CPU_SET(i, &set);
|
||||
}
|
||||
}
|
||||
|
||||
if (id == -1) {
|
||||
sched_setaffinity(0, sizeof(&set), &set);
|
||||
} else {
|
||||
pthread_setaffinity_np(pthread_self(), sizeof(&set), &set);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue