Why doesn't threading.join() return a value?

Adam Skutt askutt at gmail.com
Fri Sep 2 20:53:43 CEST 2011


On Sep 2, 2:23 pm, Alain Ketterlin <al... at dpt-info.u-strasbg.fr>
wrote:
> Sorry, you're wrong, at least for POSIX threads:
>
> void pthread_exit(void *value_ptr);
> int pthread_join(pthread_t thread, void **value_ptr);
>
> pthread_exit can pass anything, and that value will be retrieved with
> pthread_join.

No, it can only pass a void*, which isn't much better than passing an
int.  Passing a void* is not equivalent to passing anything, not even
in C.  Moreover, specific values are still reserved, like
PTHREAD_CANCELLED. Yes, it was strictly inappropriate for me to say
both return solely integers, but my error doesn't meaningful alter my
description of the situation.  The interface provided by the
underlying APIs is not especially usable for arbitrary data transfer.
Doubly so when we're discussing something like Python's threading
module.

> I'm not sure what you are talking about here. Maybe you confuse threads
> with processes?

Windows threads have exit codes, just like processes.  At least one
code is reserved and cannot be used by the programmer.

Adam



More information about the Python-list mailing list