Mercurial > cpython-lru_cache-weakref
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 20467:5b5c15a095cc | 20468:ebfd87e87884 |
|---|---|
| 141 /* | 141 /* |
| 142 * Thread support. | 142 * Thread support. |
| 143 */ | 143 */ |
| 144 | 144 |
| 145 | 145 |
| 146 int | 146 long |
| 147 PyThread_start_new_thread(void (*func)(void *), void *arg) | 147 PyThread_start_new_thread(void (*func)(void *), void *arg) |
| 148 { | 148 { |
| 149 pthread_t th; | 149 pthread_t th; |
| 150 int success; | 150 int success; |
| 151 sigset_t oldmask, newmask; | 151 sigset_t oldmask, newmask; |
| 208 pthread_detach(&th); | 208 pthread_detach(&th); |
| 209 #elif defined(PY_PTHREAD_STD) | 209 #elif defined(PY_PTHREAD_STD) |
| 210 pthread_detach(th); | 210 pthread_detach(th); |
| 211 #endif | 211 #endif |
| 212 } | 212 } |
| 213 return success != 0 ? 0 : 1; | 213 #if SIZEOF_PTHREAD_T <= SIZEOF_LONG |
| 214 return (long) th; | |
| 215 #else | |
| 216 return (long) *(long *) &th; | |
| 217 #endif | |
| 214 } | 218 } |
| 215 | 219 |
| 216 /* XXX This implementation is considered (to quote Tim Peters) "inherently | 220 /* XXX This implementation is considered (to quote Tim Peters) "inherently |
| 217 hosed" because: | 221 hosed" because: |
| 218 - It does not guanrantee the promise that a non-zero integer is returned. | 222 - It does not guanrantee the promise that a non-zero integer is returned. |
