diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2007-03-18 10:46:52 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2007-03-18 10:46:52 +0000 |
commit | 80777fa4c27a8915403627b432e7b7ffc2509620 (patch) | |
tree | e622a36642da7511fa56f08080eb9d41aaf54f6a | |
parent | 8a629f0baaac44144c502db8390fa16cdc8559e5 (diff) |
Don't restart thrsleep after a signal. After a signal happened and we
weren't on the sleep queues, the condition we were sleeping on might
have changed, so we need to go back to userland and recheck that condition.
This fixes the majority of lockups and and hanging threads in rthreads
since it fixes a race in the semaphore code.
ok tedu@
-rw-r--r-- | sys/kern/kern_synch.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 22dd6d31f55..8c8eded15d4 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_synch.c,v 1.76 2007/03/15 10:22:30 art Exp $ */ +/* $OpenBSD: kern_synch.c,v 1.77 2007/03/18 10:46:51 art Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* @@ -396,6 +396,9 @@ sys_thrsleep(struct proc *p, void *v, register_t *revtal) timo = 0; error = tsleep(&p->p_thrslpid, PUSER | PCATCH, "thrsleep", timo); + if (error == ERESTART) + error = EINTR; + return (error); } |