#include <urcu/compiler.h>
#include <urcu/arch.h>
+#include "cpuset.h"
/*
* Machine parameters.
#include <limits.h>
#include <sys/types.h>
#include <pthread.h>
-#include <sched.h>
#include <sys/param.h>
/* #include "atomic.h" */
}
spin_lock(&__thread_id_map_mutex);
for (i = 0; i < NR_THREADS; i++) {
- if (__thread_id_map[i] == tid)
+ if (__thread_id_map[i] == tid) {
spin_unlock(&__thread_id_map_mutex);
return i;
+ }
}
spin_unlock(&__thread_id_map_mutex);
- fprintf(stderr, "smp_thread_id: Rogue thread, id: %d(%#x)\n",
- (int)tid, (int)tid);
+ fprintf(stderr, "smp_thread_id: Rogue thread, id: %lu(%#lx)\n",
+ (unsigned long) tid, (unsigned long) tid);
exit(-1);
}
break;
}
if (i >= NR_THREADS){
- fprintf(stderr, "wait_thread: bad tid = %d(%#x)\n",
- (int)tid, (int)tid);
+ fprintf(stderr, "wait_thread: bad tid = %lu(%#lx)\n",
+ (unsigned long)tid, (unsigned long)tid);
exit(-1);
}
if (pthread_join(tid, &vp) != 0) {
}
}
-#ifndef HAVE_CPU_SET_T
-typedef unsigned long cpu_set_t;
-# define CPU_ZERO(cpuset) do { *(cpuset) = 0; } while(0)
-# define CPU_SET(cpu, cpuset) do { *(cpuset) |= (1UL << (cpu)); } while(0)
-#endif
-
static void run_on(int cpu)
{
#if HAVE_SCHED_SETAFFINITY