#ifndef _HAPROXY_THREAD_H
#define _HAPROXY_THREAD_H
-#include <signal.h>
-#include <unistd.h>
-#ifdef _POSIX_PRIORITY_SCHEDULING
-#include <sched.h>
-#endif
-
#include <haproxy/api.h>
#include <haproxy/thread-t.h>
#include <haproxy/tinfo.h>
/* Generic exports */
int parse_nbthread(const char *arg, char **err);
+void ha_tkill(unsigned int thr, int sig);
+void ha_tkillall(int sig);
+void ha_thread_relax(void);
extern int thread_cpus_enabled_at_boot;
ti = &ha_thread_info[tid];
}
-static inline void ha_thread_relax(void)
-{
-#ifdef _POSIX_PRIORITY_SCHEDULING
- sched_yield();
-#endif
-}
-
-/* send signal <sig> to thread <thr> */
-static inline void ha_tkill(unsigned int thr, int sig)
-{
- raise(sig);
-}
-
-/* send signal <sig> to all threads */
-static inline void ha_tkillall(int sig)
-{
- raise(sig);
-}
-
static inline void thread_idle_now()
{
}
void thread_isolate_full(void);
void thread_release(void);
void thread_sync_release(void);
-void ha_tkill(unsigned int thr, int sig);
-void ha_tkillall(int sig);
void ha_spin_init(HA_SPINLOCK_T *l);
void ha_rwlock_init(HA_RWLOCK_T *l);
void setup_extra_threads(void *(*handler)(void *));
ti = &ha_thread_info[tid];
}
-static inline void ha_thread_relax(void)
-{
-#ifdef _POSIX_PRIORITY_SCHEDULING
- sched_yield();
-#else
- pl_cpu_relax();
-#endif
-}
-
/* Marks the thread as idle, which means that not only it's not doing anything
* dangerous, but in addition it has not started anything sensitive either.
* This essentially means that the thread currently is in the poller, thus
#include <stdlib.h>
#include <fcntl.h>
+#include <signal.h>
+#include <unistd.h>
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#include <sched.h>
+#endif
+
#ifdef USE_THREAD
# include <pthread.h>
#endif
raise(sig);
}
+void ha_thread_relax(void)
+{
+#ifdef _POSIX_PRIORITY_SCHEDULING
+ sched_yield();
+#else
+ pl_cpu_relax();
+#endif
+}
+
/* these calls are used as callbacks at init time when debugging is on */
void ha_spin_init(HA_SPINLOCK_T *l)
{
#else
+/* send signal <sig> to thread <thr> (send to process in fact) */
+void ha_tkill(unsigned int thr, int sig)
+{
+ raise(sig);
+}
+
+/* send signal <sig> to all threads (send to process in fact) */
+void ha_tkillall(int sig)
+{
+ raise(sig);
+}
+
+void ha_thread_relax(void)
+{
+#ifdef _POSIX_PRIORITY_SCHEDULING
+ sched_yield();
+#endif
+}
+
REGISTER_BUILD_OPTS("Built without multi-threading support (USE_THREAD not set).");
#endif // USE_THREAD