#ifndef USE_THREAD
+#define MAX_THREADS 1
+
#define __decl_hathreads(decl)
#define HA_ATOMIC_CAS(val, old, new) ({((*val) == (*old)) ? (*(val) = (new) , 1) : (*(old) = *(val), 0);})
#include <pthread.h>
#include <import/plock.h>
+#define MAX_THREADS LONGBITS
+
#define __decl_hathreads(decl) decl
/* TODO: thread: For now, we rely on GCC builtins but it could be a good idea to
goto out;
}
global.nbthread = atol(args[1]);
- if (global.nbthread < 1 || global.nbthread > LONGBITS) {
- ha_alert("parsing [%s:%d] : '%s' must be between 1 and %d (was %d).\n",
- file, linenum, args[0], LONGBITS, global.nbthread);
- err_code |= ERR_ALERT | ERR_FATAL;
- goto out;
- }
#ifndef USE_THREAD
if (global.nbthread > 1) {
ha_alert("HAProxy is not compiled with threads support, please check build options for USE_THREAD.\n");
goto out;
}
#endif
+ if (global.nbthread < 1 || global.nbthread > MAX_THREADS) {
+ ha_alert("parsing [%s:%d] : '%s' must be between 1 and %d (was %d).\n",
+ file, linenum, args[0], MAX_THREADS, global.nbthread);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
}
else if (!strcmp(args[0], "maxconn")) {
if (alertif_too_many_args(1, file, linenum, args, &err_code))
}
/* Mapping at the thread level */
- for (j = 0; j < LONGBITS; j++) {
+ for (j = 0; j < MAX_THREADS; j++) {
/* Np mapping for this thread */
if (!(thread & (1UL << j)))
continue;
if (global.cpu_map.proc[relative_pid-1])
global.cpu_map.thread[relative_pid-1][i] &= global.cpu_map.proc[relative_pid-1];
- if (i < LONGBITS && /* only the first 32/64 threads may be pinned */
+ if (i < MAX_THREADS && /* only the first 32/64 threads may be pinned */
global.cpu_map.thread[relative_pid-1][i]) {/* only do this if the thread has a THREAD map */
#if defined(__FreeBSD__) || defined(__NetBSD__)
cpuset_t cpuset;