diff Python/thread_pthread.h @ 20468:ebfd87e87884 legacy-trunk

Partial patch from SF #452266, by Jason Petrone. This changes Pythread_start_thread() to return the thread ID, or -1 for an error. (It's technically an incompatible API change, but I doubt anyone calls it.)
author Guido van Rossum <guido@python.org>
date Tue, 16 Oct 2001 21:13:49 +0000
parents cee0fe5fce11
children 7a991d012cd6
line wrap: on
line diff
--- a/Python/thread_pthread.h	Tue Oct 16 20:42:52 2001 +0000
+++ b/Python/thread_pthread.h	Tue Oct 16 21:13:49 2001 +0000
@@ -143,7 +143,7 @@
  */
 
 
-int 
+long
 PyThread_start_new_thread(void (*func)(void *), void *arg)
 {
 	pthread_t th;
@@ -210,7 +210,11 @@
 		pthread_detach(th);
 #endif
 	}
-	return success != 0 ? 0 : 1;
+#if SIZEOF_PTHREAD_T <= SIZEOF_LONG
+	return (long) th;
+#else
+	return (long) *(long *) &th;
+#endif
 }
 
 /* XXX This implementation is considered (to quote Tim Peters) "inherently