Index: lib/libthr/thread/thr_kern.c =================================================================== RCS file: /home/ncvs/src/lib/libthr/thread/thr_kern.c,v retrieving revision 1.8 diff -u -r1.8 thr_kern.c --- lib/libthr/thread/thr_kern.c 25 May 2003 07:58:22 -0000 1.8 +++ lib/libthr/thread/thr_kern.c 27 Jun 2003 00:56:24 -0000 @@ -55,6 +55,18 @@ void _thread_critical_enter(pthread_t pthread) { + /* + * We can not use the global 'restore' set until after we have + * acquired the giant lock. + */ + _SPINLOCK(&pthread->lock); + + _thread_sigblock(); +} + +void +_thread_sigblock() +{ sigset_t set; sigset_t sav; @@ -62,12 +74,7 @@ * Block all signals. */ SIGFILLSET(set); - - /* - * We can not use the global 'restore' set until after we have - * acquired the giant lock. - */ - _SPINLOCK(&pthread->lock); + SIGADDSET(set, SIGTHR); /* If we are already in a critical section, just up the refcount */ if (++curthread->crit_ref > 1) @@ -84,7 +91,7 @@ } void -_thread_critical_exit(pthread_t pthread) +_thread_sigunblock() { sigset_t set; @@ -103,7 +110,14 @@ errno); abort(); } +} + + +void +_thread_critical_exit(pthread_t pthread) +{ _SPINUNLOCK(&pthread->lock); + _thread_sigunblock(); } void Index: lib/libthr/thread/thr_private.h =================================================================== RCS file: /home/ncvs/src/lib/libthr/thread/thr_private.h,v retrieving revision 1.15 diff -u -r1.15 thr_private.h --- lib/libthr/thread/thr_private.h 3 Jun 2003 09:31:33 -0000 1.15 +++ lib/libthr/thread/thr_private.h 27 Jun 2003 00:36:31 -0000 @@ -765,6 +765,8 @@ int _thread_suspend(pthread_t thread, struct timespec *abstime); void _thread_critical_enter(pthread_t); void _thread_critical_exit(pthread_t); +void _thread_sigblock(); +void _thread_sigunblock(); /* #include */ #ifdef _SYS_AIO_H_ Index: lib/libthr/thread/thr_spinlock.c =================================================================== RCS file: /home/ncvs/src/lib/libthr/thread/thr_spinlock.c,v retrieving revision 1.4 diff -u -r1.4 thr_spinlock.c --- lib/libthr/thread/thr_spinlock.c 25 May 2003 08:48:11 -0000 1.4 +++ lib/libthr/thread/thr_spinlock.c 27 Jun 2003 01:21:42 -0000 @@ -55,6 +55,7 @@ { if (umtx_unlock((struct umtx *)lck, pthread->thr_id)) abort(); + _thread_sigunblock(); } /* @@ -73,15 +74,19 @@ _spintrylock(spinlock_t *lck) { int error; + _thread_sigblock(); error = umtx_trylock((struct umtx *)lck, curthread->thr_id); if (error != 0 && error != EBUSY) abort(); + else if (error == EBUSY) + _thread_sigunblock(); return (error); } inline void _spinlock_pthread(pthread_t pthread, spinlock_t *lck) { + _thread_sigblock(); if (umtx_lock((struct umtx *)lck, pthread->thr_id)) abort(); }