Fix PR 6417: if we're starting a thread and there's no other threads
authorguenther <guenther@openbsd.org>
Tue, 13 Jul 2010 04:24:46 +0000 (04:24 +0000)
committerguenther <guenther@openbsd.org>
Tue, 13 Jul 2010 04:24:46 +0000 (04:24 +0000)
running, then we need to start a gc thread...except when this is
the very call to start a gc thread!

"This works for me" marc@

lib/libpthread/uthread/uthread_create.c

index fe40c5e..e2248a9 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uthread_create.c,v 1.24 2009/07/25 02:09:20 kurt Exp $        */
+/*     $OpenBSD: uthread_create.c,v 1.25 2010/07/13 04:24:46 guenther Exp $    */
 /*
  * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
  * All rights reserved.
@@ -179,7 +179,8 @@ pthread_create(pthread_t *thread, const pthread_attr_t *attr,
                         * Check if the garbage collector thread
                         * needs to be started.
                         */
-                       f_gc = (TAILQ_FIRST(&_thread_list) == _thread_initial);
+                       f_gc = (TAILQ_FIRST(&_thread_list) == _thread_initial
+                           && start_routine != _thread_gc);
 
                        /* Add the thread to the linked list of all threads: */
                        TAILQ_INSERT_HEAD(&_thread_list, new_thread, tle);