summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread/uthread_sig.c
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1998-12-21 07:42:55 +0000
committerDavid Leonard <d@cvs.openbsd.org>1998-12-21 07:42:55 +0000
commitc8c5343c0ee8fb83ece66cc547b716a011aed14c (patch)
tree5df72765206c5e0ced2cbaeafaa9f14d02978d5f /lib/libpthread/uthread/uthread_sig.c
parenta717466ceccace8516093f670e2abe56ea96c3b3 (diff)
use md spinlock; signal statistics
Diffstat (limited to 'lib/libpthread/uthread/uthread_sig.c')
-rw-r--r--lib/libpthread/uthread/uthread_sig.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libpthread/uthread/uthread_sig.c b/lib/libpthread/uthread/uthread_sig.c
index 3e55d6505a3..85aca6cbe57 100644
--- a/lib/libpthread/uthread/uthread_sig.c
+++ b/lib/libpthread/uthread/uthread_sig.c
@@ -42,6 +42,8 @@
static int volatile yield_on_unlock_thread = 0;
static spinlock_t thread_link_list_lock = _SPINLOCK_INITIALIZER;
+int _thread_sig_statistics[NSIG];
+
/* Lock the thread list: */
void
_lock_thread_list()
@@ -78,6 +80,11 @@ _thread_sig_handler(int sig, int code, struct sigcontext * scp)
pthread_t pthread;
/*
+ * Record the number of times this signal has been received
+ */
+ _thread_sig_statistics[sig]++;
+
+ /*
* Check if the pthread kernel has unblocked signals (or is about to)
* and was on its way into a _select when the current
* signal interrupted it:
@@ -106,7 +113,7 @@ _thread_sig_handler(int sig, int code, struct sigcontext * scp)
* unfortunate time which one of the threads is
* modifying the thread list:
*/
- if (thread_link_list_lock.access_lock)
+ if (_atomic_is_locked(&thread_link_list_lock.access_lock))
/*
* Set a flag so that the thread that has
* the lock yields when it unlocks the