diff options
author | mtm <mtm@FreeBSD.org> | 2003-12-11 08:34:07 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2003-12-11 08:34:07 +0000 |
commit | 56a475799e92c028826a991b13ec8e0e2f0b6d88 (patch) | |
tree | 4cf817efcd47da84f164c8ec1f4e83340f1e7014 /lib/libthr/thread/thr_resume_np.c | |
parent | b37897400db991ebb79d0fdd993975c8dcd48cdf (diff) | |
download | FreeBSD-src-56a475799e92c028826a991b13ec8e0e2f0b6d88.zip FreeBSD-src-56a475799e92c028826a991b13ec8e0e2f0b6d88.tar.gz |
Remove uses of GIANT_LOCK and replace with appropriate thread
and thread list locks.
Diffstat (limited to 'lib/libthr/thread/thr_resume_np.c')
-rw-r--r-- | lib/libthr/thread/thr_resume_np.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/libthr/thread/thr_resume_np.c b/lib/libthr/thread/thr_resume_np.c index 26b4d07..0269228 100644 --- a/lib/libthr/thread/thr_resume_np.c +++ b/lib/libthr/thread/thr_resume_np.c @@ -49,12 +49,12 @@ _pthread_resume_np(pthread_t thread) /* Find the thread in the list of active threads: */ if ((ret = _find_thread(thread)) == 0) { - GIANT_LOCK(curthread); + _thread_critical_enter(curthread); if ((thread->flags & PTHREAD_FLAGS_SUSPENDED) != 0) resume_common(thread); - GIANT_UNLOCK(curthread); + _thread_critical_exit(curthread); } return (ret); } @@ -64,17 +64,22 @@ _pthread_resume_all_np(void) { struct pthread *thread; - GIANT_LOCK(curthread); - + THREAD_LIST_LOCK; TAILQ_FOREACH(thread, &_thread_list, tle) { if ((thread != curthread) && - ((thread->flags & PTHREAD_FLAGS_SUSPENDED) != 0)) + ((thread->flags & PTHREAD_FLAGS_SUSPENDED) != 0)) { + _thread_critical_enter(thread); resume_common(thread); + _thread_critical_exit(thread); + } } - - GIANT_UNLOCK(curthread); + THREAD_LIST_UNLOCK; } +/* + * The caller is required to have locked the thread before + * calling this function. + */ static void resume_common(struct pthread *thread) { |