Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread Fix a problem where pthread_kill can set a si...



details:   https://anonhg.NetBSD.org/src/rev/a11141e0320d
branches:  trunk
changeset: 559856:a11141e0320d
user:      lha <lha%NetBSD.org@localhost>
date:      Wed Mar 24 20:01:37 2004 +0000

description:
Fix a problem where pthread_kill can set a signal while the process
have the signal blocked, this ends up making target thread getting
later stuck in a loop if it uses pthread_sigmask.

ok, cl and christos

diffstat:

 lib/libpthread/pthread_sig.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 2fc21168feeb -r a11141e0320d lib/libpthread/pthread_sig.c
--- a/lib/libpthread/pthread_sig.c      Wed Mar 24 19:42:04 2004 +0000
+++ b/lib/libpthread/pthread_sig.c      Wed Mar 24 20:01:37 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_sig.c,v 1.33 2004/01/02 19:24:44 cl Exp $      */
+/*     $NetBSD: pthread_sig.c,v 1.34 2004/03/24 20:01:37 lha Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_sig.c,v 1.33 2004/01/02 19:24:44 cl Exp $");
+__RCSID("$NetBSD: pthread_sig.c,v 1.34 2004/03/24 20:01:37 lha Exp $");
 
 /* We're interposing a specific version of the signal interface. */
 #define        __LIBC12_SOURCE__
@@ -597,18 +597,22 @@
 
        /* See if there are any signals to take */
        __sigemptyset14(&takelist);
-       while ((i = firstsig(&self->pt_siglist)) != 0) {
+       tmp = self->pt_siglist;
+       while ((i = firstsig(&tmp)) != 0) {
                if (!__sigismember14(&self->pt_sigmask, i)) {
                        __sigaddset14(&takelist, i);
                        __sigdelset14(&self->pt_siglist, i);
                }
+               __sigdelset14(&tmp, i);
        }
        pthread_spinlock(self, &pt_process_siglock);
-       while ((i = firstsig(&pt_process_siglist)) != 0) {
+       tmp = pt_process_siglist;
+       while ((i = firstsig(&tmp)) != 0) {
                if (!__sigismember14(&self->pt_sigmask, i)) {
                        __sigaddset14(&takelist, i);
                        __sigdelset14(&pt_process_siglist, i);
                }
+               __sigdelset14(&tmp, i);
        }
        /* Unblock any signals that were blocked process-wide before this. */
        tmp = pt_process_sigmask;



Home | Main Index | Thread Index | Old Index