fix non linux support

This commit is contained in:
David Terei 2014-12-11 21:04:26 -08:00
parent e1d371784c
commit a742f44cb7

View File

@ -660,7 +660,9 @@ void go(const vector<string>& servers, options_t& options,
vector<string> ts[options.threads]; vector<string> ts[options.threads];
#endif #endif
#ifdef __linux__
int current_cpu = -1; int current_cpu = -1;
#endif
for (int t = 0; t < options.threads; t++) { for (int t = 0; t < options.threads; t++) {
td[t].options = &options; td[t].options = &options;
@ -683,6 +685,7 @@ void go(const vector<string>& servers, options_t& options,
pthread_attr_t attr; pthread_attr_t attr;
pthread_attr_init(&attr); pthread_attr_init(&attr);
#ifdef __linux__
if (args.affinity_given) { if (args.affinity_given) {
int max_cpus = 8 * sizeof(cpu_set_t); int max_cpus = 8 * sizeof(cpu_set_t);
cpu_set_t m; cpu_set_t m;
@ -704,6 +707,7 @@ void go(const vector<string>& servers, options_t& options,
} }
} }
} }
#endif
if (pthread_create(&pt[t], &attr, thread_main, &td[t])) if (pthread_create(&pt[t], &attr, thread_main, &td[t]))
DIE("pthread_create() failed"); DIE("pthread_create() failed");