aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Makonnen <mtm@FreeBSD.org>2003-07-08 09:58:23 +0000
committerMike Makonnen <mtm@FreeBSD.org>2003-07-08 09:58:23 +0000
commit393441d43b6de1b136dc816902477f8e34ff90a8 (patch)
tree0db0159177bc3431faaebf30c10dae49c467160c /lib
parent4d233f6b0d065d9231ed0cb5ffb8c43524e3a847 (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/thread/thr_init.c3
-rw-r--r--lib/libthr/thread/thr_kern.c3
-rw-r--r--lib/libthr/thread/thr_private.h15
3 files changed, 19 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c
index 671bd6fa40af4..86622b6251a26 100644
--- a/lib/libthr/thread/thr_init.c
+++ b/lib/libthr/thread/thr_init.c
@@ -349,6 +349,9 @@ _thread_init(void)
SIGEMPTYSET(_thread_suspend_sigset);
SIGADDSET(_thread_suspend_sigset, SIGTHR);
}
+#ifdef _PTHREADS_INVARIANTS
+ SIGADDSET(_thread_suspend_sigset, SIGALRM);
+#endif
/* Get the kernel clockrate: */
mib[0] = CTL_KERN;
diff --git a/lib/libthr/thread/thr_kern.c b/lib/libthr/thread/thr_kern.c
index b3dae7da20e3f..f99547ee0b1cb 100644
--- a/lib/libthr/thread/thr_kern.c
+++ b/lib/libthr/thread/thr_kern.c
@@ -77,6 +77,9 @@ _thread_sigblock()
*/
SIGFILLSET(set);
SIGADDSET(set, SIGTHR);
+#ifdef _PTHREADS_INVARIANTS
+ SIGDELSET(set, SIGABRT);
+#endif
/* If we have already blocked signals, just up the refcount */
if (++curthread->signest > 1)
diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h
index 3260c9b40dd2a..c1e8b0a7a5ced 100644
--- a/lib/libthr/thread/thr_private.h
+++ b/lib/libthr/thread/thr_private.h
@@ -60,6 +60,7 @@
#include <spinlock.h>
#include <stdio.h>
#include <ucontext.h>
+#include <unistd.h>
#include <machine/atomic.h>
#include <sys/thr.h>
@@ -68,8 +69,18 @@
/*
* Kernel fatal error handler macro.
*/
-#define PANIC(string) _thread_exit(__FILE__,__LINE__,string)
-
+#ifndef _PTHREADS_INVARIANTS
+#define PANIC(string) _thread_exit(__FILE__, __LINE__, (string))
+#else /* _PTHREADS_INVARIANTS */
+#define PANIC(string) \
+ do { \
+ _thread_printf(STDOUT_FILENO, (string)); \
+ _thread_printf(STDOUT_FILENO, \
+ "\nAbnormal termination, file: %s, line: %d\n", \
+ __FILE__, __LINE__); \
+ abort(); \
+ } while (0)
+#endif /* !_PTHREADS_INVARIANTS */
/* Output debug messages like this: */
#define stdout_debug(args...) _thread_printf(STDOUT_FILENO, args)