summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/TSRM.c16
-rw-r--r--TSRM/TSRM.h7
-rw-r--r--TSRM/tsrm.m42
3 files changed, 25 insertions, 0 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
index 41368a4987..efdea5c880 100644
--- a/TSRM/TSRM.c
+++ b/TSRM/TSRM.c
@@ -710,6 +710,22 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
#endif
}
+/*
+ Changes the signal mask of the calling thread
+*/
+#ifdef HAVE_SIGPROCMASK
+TSRM_API int tsrm_sigmask(int how, const sigset_t *set, sigset_t *oldset)
+{
+ TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Changed sigmask in thread: %ld", tsrm_thread_id()));
+ /* TODO: add support for other APIs */
+#ifdef PTHREADS
+ return pthread_sigmask(how, set, oldset);
+#else
+ return sigprocmask(how, set, oldset);
+#endif
+}
+#endif
+
TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler)
{
diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h
index d3d6f9b2d7..b232429d4d 100644
--- a/TSRM/TSRM.h
+++ b/TSRM/TSRM.h
@@ -90,6 +90,10 @@ typedef struct {
# define MUTEX_T beos_ben *
#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
typedef void (*ts_allocate_ctor)(void *, void ***);
typedef void (*ts_allocate_dtor)(void *, void ***);
@@ -138,6 +142,9 @@ TSRM_API MUTEX_T tsrm_mutex_alloc(void);
TSRM_API void tsrm_mutex_free(MUTEX_T mutexp);
TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp);
TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp);
+#ifdef HAVE_SIGPROCMASK
+TSRM_API int tsrm_sigmask(int how, const sigset_t *set, sigset_t *oldset);
+#endif
TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler);
TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler);
diff --git a/TSRM/tsrm.m4 b/TSRM/tsrm.m4
index 85e6a83a83..b53a4bb805 100644
--- a/TSRM/tsrm.m4
+++ b/TSRM/tsrm.m4
@@ -30,6 +30,8 @@ AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_CHECK_HEADERS(stdarg.h)
+AC_CHECK_FUNCS(sigprocmask)
+
])