Subject: Re: lib/35969 (ghc-6.4.2 from pkgsrc fails to compile)
To: None <gnats-bugs@NetBSD.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: netbsd-bugs
Date: 03/13/2007 11:48:54
>  The thread is not sleeping and is not on a sleep queue, yet it's parked.
>  pt_sleepq indicates that it was last waiting on the the CV from the
>  stack trace. From the CV above, the mutex pointer is NULL meaning that
>  a wake up has occurred - no more waiters on the CV so the mutex pointer
>  has been cleared. So there is some synchronization failure occurring
>  between removing the LWP from its sleep queue and unparking it.

i guess _lwp_park is being restarted.

YAMAMOTO Takashi

Index: sys_lwp.c
===================================================================
RCS file: /cvsroot/src/sys/kern/sys_lwp.c,v
retrieving revision 1.12
diff -u -p -r1.12 sys_lwp.c
--- sys_lwp.c	9 Mar 2007 05:00:26 -0000	1.12
+++ sys_lwp.c	13 Mar 2007 01:56:19 -0000
@@ -508,7 +508,18 @@ sys__lwp_park(struct lwp *l, void *v, re
 	sleepq_block(sq, sched_kpri(l), wchan, "parked", timo, 1,
 	    &lwp_park_sobj);
 	error = sleepq_unblock(timo, 1);
-	return error == EWOULDBLOCK ? ETIMEDOUT : error;
+	switch (error) {
+		case EWOULDBLOCK:
+			error = ETIMEDOUT;
+			break;
+		case ERESTART:
+			error = EINTR;
+			break;
+		default:
+			/* nothing */
+			break;
+	}
+	return error;
 }
 
 int