Fixes for OS X.

This commit is contained in:
Admin 2017-06-14 21:13:04 +03:00 committed by Admin
parent 555eee8236
commit faf14f5e5a
3 changed files with 5 additions and 16 deletions

View file

@ -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);
}
}

View file

@ -42,6 +42,10 @@ void Cpu::init()
void Cpu::setAffinity(int id, unsigned long mask)
{
if (id == -1) {
return;
}
cpu_set_t set;
CPU_ZERO(&set);

View file

@ -24,7 +24,6 @@
#include <stdlib.h>
#include "net/Network.h"
#include "version.h"
@ -34,7 +33,7 @@ char *Network::userAgent()
const size_t max = 128;
char *buf = static_cast<char*>(malloc(max));
snprintf(buf, max, "%s/%s", APP_NAME, APP_VERSION);
snprintf(buf, max, "%s/%s (Macintosh; Intel Mac OS X) libuv/%s clang/%d.%d.%d", APP_NAME, APP_VERSION, uv_version_string(), __clang_major__, __clang_minor__, __clang_patchlevel__);
return buf;
}