MINOR: threads: implement ha_tkill() and ha_tkillall()
These functions are used respectively to signal one thread or all threads.
When multithreading is disabled, it's always the current thread which is
signaled.
diff --git a/include/common/hathreads.h b/include/common/hathreads.h
index 0bc6e45..77bd617 100644
--- a/include/common/hathreads.h
+++ b/include/common/hathreads.h
@@ -22,6 +22,7 @@
#ifndef _COMMON_HATHREADS_H
#define _COMMON_HATHREADS_H
+#include <signal.h>
#include <unistd.h>
#ifdef _POSIX_PRIORITY_SCHEDULING
#include <sched.h>
@@ -157,6 +158,18 @@
#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 __ha_barrier_atomic_load(void)
{
}
@@ -383,6 +396,8 @@
void thread_harmless_till_end();
void thread_isolate();
void thread_release();
+void ha_tkill(unsigned int thr, int sig);
+void ha_tkillall(int sig);
extern struct thread_info {
pthread_t pthread;