summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2003-04-28 21:35:06 +0000
committerdeischen <deischen@FreeBSD.org>2003-04-28 21:35:06 +0000
commit4d8bc81d7dbf95940ea714cfb3e40d8c78315341 (patch)
tree2807b11e0e61a9d6cd6961bfb98d0119e4ebc25d /lib/libpthread
parent389061c1253888e312a58cff19cf6822c4a9439d (diff)
downloadFreeBSD-src-4d8bc81d7dbf95940ea714cfb3e40d8c78315341.zip
FreeBSD-src-4d8bc81d7dbf95940ea714cfb3e40d8c78315341.tar.gz
Use the correct link entry for walking the list of threads.
While I'm here, use the TAILQ_FOREACH macro instead of a more manual method which was inherited from libc_r (so we could remove elements from the list which isn't needed for libpthread). Submitted by: Kazuaki Oda <kaakun@highway.ne.jp>
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/thread/thr_sig.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/libpthread/thread/thr_sig.c b/lib/libpthread/thread/thr_sig.c
index de177d9..5ac4998 100644
--- a/lib/libpthread/thread/thr_sig.c
+++ b/lib/libpthread/thread/thr_sig.c
@@ -258,7 +258,7 @@ struct pthread *
thr_sig_find(struct kse *curkse, int sig, siginfo_t *info)
{
int handler_installed;
- struct pthread *pthread, *pthread_next;
+ struct pthread *pthread;
struct pthread *suspended_thread, *signaled_thread;
DBG_MSG("Looking for thread to handle signal %d\n", sig);
@@ -285,14 +285,7 @@ thr_sig_find(struct kse *curkse, int sig, siginfo_t *info)
signaled_thread = NULL;
KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
- for (pthread = TAILQ_FIRST(&_thread_list);
- pthread != NULL; pthread = pthread_next) {
- /*
- * Grab the next thread before possibly destroying
- * the link entry.
- */
- pthread_next = TAILQ_NEXT(pthread, pqe);
-
+ TAILQ_FOREACH(pthread, &_thread_list, tle) {
if ((pthread->state == PS_SIGWAIT) &&
sigismember(pthread->data.sigwait, sig)) {
/* Take the scheduling lock. */
OpenPOWER on IntegriCloud