diff options
author | jeff <jeff@FreeBSD.org> | 2003-04-01 22:41:41 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2003-04-01 22:41:41 +0000 |
commit | 4b5aacdfc871360134c035a6c5e6010072f105a6 (patch) | |
tree | 57e53bd64ff482e07d9e7557a1aa98cbe03389c6 /lib/libthr/thread/thr_kern.c | |
parent | 886873a91d65f6b2ba6dd2c7bea20bf42088c8f5 (diff) | |
download | FreeBSD-src-4b5aacdfc871360134c035a6c5e6010072f105a6.zip FreeBSD-src-4b5aacdfc871360134c035a6c5e6010072f105a6.tar.gz |
- Don't drop and reacquire giant in thread_suspend(). Change callers to do
this manually. This will facilitate the unrolling of giant.
- Don't allow giant to recurse anymore. This should never happen.
Diffstat (limited to 'lib/libthr/thread/thr_kern.c')
-rw-r--r-- | lib/libthr/thread/thr_kern.c | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/lib/libthr/thread/thr_kern.c b/lib/libthr/thread/thr_kern.c index 1ad8526..2f9e086 100644 --- a/lib/libthr/thread/thr_kern.c +++ b/lib/libthr/thread/thr_kern.c @@ -50,9 +50,6 @@ static sigset_t restore; -pthread_t _giant_owner = NULL; -int _giant_count = 0; - void GIANT_LOCK(pthread_t pthread) { @@ -60,11 +57,6 @@ GIANT_LOCK(pthread_t pthread) sigset_t sav; int error; - if (_giant_owner == pthread) { - abort(); - _giant_count++; - } - /* * Block all signals. */ @@ -88,9 +80,6 @@ GIANT_LOCK(pthread_t pthread) abort(); } - _giant_owner = pthread; - _giant_count = 1; - restore = sav; } @@ -100,14 +89,6 @@ GIANT_UNLOCK(pthread_t pthread) sigset_t set; int error; - if (_giant_owner != pthread) - abort(); - - if (--_giant_count > 0) - return; - - _giant_owner = NULL; - /* * restore is protected by giant. We could restore our signal state * incorrectly if someone else set restore between unlocking giant @@ -135,13 +116,12 @@ GIANT_UNLOCK(pthread_t pthread) } int -_thread_suspend(pthread_t thread, struct timespec *abstime) +_thread_suspend(pthread_t pthread, struct timespec *abstime) { struct timespec remaining; struct timespec *ts; siginfo_t info; sigset_t set; - int giant_count; /* Saved recursion */ int error; /* @@ -150,6 +130,9 @@ _thread_suspend(pthread_t thread, struct timespec *abstime) SIGFILLSET(set); SIGDELSET(set, SIGTHR); + /* + * Compute the remainder of the run time. + */ if (abstime) { struct timespec now; struct timeval tv; @@ -163,26 +146,9 @@ _thread_suspend(pthread_t thread, struct timespec *abstime) } else ts = NULL; - /* - * Save and unroll the recursion count. - */ - giant_count = _giant_count; - _giant_count = 1; - GIANT_UNLOCK(thread); - error = sigtimedwait(&set, &info, ts); if (error == -1) error = errno; - /* XXX Kernel bug. */ - if (error == EINTR) - error = 0; - - /* - * Restore the recursion count. - */ - GIANT_LOCK(thread); - _giant_count = giant_count; - return (error); } |