Mercurial > cpython-lru_cache-weakref
comparison Python/thread_pth.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 | 5aa8c5aaffad |
| children | 8b116a8449bd |
comparison
equal
deleted
inserted
replaced
| 20467:5b5c15a095cc | 20468:ebfd87e87884 |
|---|---|
| 42 /* | 42 /* |
| 43 * Thread support. | 43 * Thread support. |
| 44 */ | 44 */ |
| 45 | 45 |
| 46 | 46 |
| 47 int PyThread_start_new_thread(void (*func)(void *), void *arg) | 47 long PyThread_start_new_thread(void (*func)(void *), void *arg) |
| 48 { | 48 { |
| 49 pth_t th; | 49 pth_t th; |
| 50 dprintf(("PyThread_start_new_thread called\n")); | 50 dprintf(("PyThread_start_new_thread called\n")); |
| 51 if (!initialized) | 51 if (!initialized) |
| 52 PyThread_init_thread(); | 52 PyThread_init_thread(); |
| 54 th = pth_spawn(PTH_ATTR_DEFAULT, | 54 th = pth_spawn(PTH_ATTR_DEFAULT, |
| 55 (void* (*)(void *))func, | 55 (void* (*)(void *))func, |
| 56 (void *)arg | 56 (void *)arg |
| 57 ); | 57 ); |
| 58 | 58 |
| 59 return th == NULL ? 0 : 1; | 59 return th; |
| 60 } | 60 } |
| 61 | 61 |
| 62 long PyThread_get_thread_ident(void) | 62 long PyThread_get_thread_ident(void) |
| 63 { | 63 { |
| 64 volatile pth_t threadid; | 64 volatile pth_t threadid; |
