Re: segfault in builtins-thread.c

Ben Collins <[email protected]> Thu, 20 May 2004 13:00:56 -0400
Newsgroups gmane.comp.lang.prothon.devel
Message-ID <[email protected]>
> #0  register_thread (this_thread=0x809cf10) at builtins-thread.c:98
> 98              pr_thread_p thread_ptr    = res->data.ptr;
> 
> now a 'print res' at this point gives:
> $1 = 0x0

Try this patch. Since the thread creation is protected by
thread_registry_lock, new_thread_object should be safe used this way.


Index: src/builtins-thread.c
===================================================================
--- src/builtins-thread.c	(revision 512)
+++ src/builtins-thread.c	(working copy)
@@ -140,10 +140,11 @@
 	}
 	thread_p->ist = new_ist(acc_level);
 
+	new_thread_object = thread_obj;
+
 	aprerr = apr_thread_create(&new_thread, thread_attr, thread_func, thread_data, thread_pool);
 	IF_APR_ERR("apr_thread_create") return NULL;
 
-	new_thread_object = thread_obj;
 	return thread_obj;
 }
 

-- 
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/
WatchGuard - http://www.watchguard.com/