Subject: Re: libpthread busted?
To: Peter Seebach <seebs@plethora.net>
From: Love <lha@stacken.kth.se>
List: current-users
Date: 02/28/2003 12:30:30
seebs@plethora.net (Peter Seebach) writes:

> assertion "next != 0" failed: file "/usr/src/lib/libpthread/pthread_run.c", line 115, function "pthread__next"
>
> I seem to have started getting these messages since building a new userland
> today.  Anyone else?

A backtrace would be good, but if you have the same problem as IWAMOTO
Toshihiro (describe in pr lib/20519) this patch might work.

Pthread people, should it call a libc hook instead ?

Love

Index: pthread_sig.c
===================================================================
RCS file: /cvs/src/lib/libpthread/pthread_sig.c,v
retrieving revision 1.9
diff -u -u -w -r1.9 pthread_sig.c
--- pthread_sig.c	15 Feb 2003 21:19:00 -0000	1.9
+++ pthread_sig.c	28 Feb 2003 11:23:23 -0000
@@ -63,6 +63,8 @@
 #define SDPRINTF(x)
 #endif
 
+extern int pthread__started;
+
 extern pthread_spin_t pthread__runqueue_lock;
 extern struct pthread_queue_t pthread__runqueue;
 
@@ -198,12 +200,18 @@
 	return retval;
 }
 
+int _sys___sigsuspend14(const sigset_t *);
+
 int
 __sigsuspend14(const sigset_t *sigmask)
 {
 	pthread_t self;
 	sigset_t oldmask;
 
+	/* if threading not started yet, just do the syscall */
+	if (__predict_false(pthread__started == 0))
+		return (_sys___sigsuspend14(sigmask));
+
 	self = pthread__self();
 
 	pthread_spinlock(self, &pt_sigsuspended_lock);
@@ -252,7 +260,6 @@
 	int error = 0;
 	pthread_t target;
 	sigset_t wset;
-	extern int pthread__started;
 	struct timespec timo;
 
 	/* if threading not started yet, just do the syscall */