Is there a way to ‘join’ (block) in POSIX threads, without exiting the joinee?
Posted
by elliottcable
on Stack Overflow
See other posts from Stack Overflow
or by elliottcable
Published on 2010-05-01T23:40:55Z
Indexed on
2010/05/01
23:47 UTC
Read the original article
Hit count: 910
I’m buried in multithreading / parallelism documents, trying to figure out how to implement a threading implementation in a programming language I’ve been designing.
I’m trying to map a mental model to the pthreads.h
library, but I’m having trouble with one thing: I need my interpreter instances to continue to exist after they complete interpretation of a routine
(the language’s closure/function data type), because I want to later assign other routine
s to them for interpretation, thus saving me the thread and interpreter setup/teardown time.
This would be fine, except that pthread_join(3)
requires that I call pthread_exit(3)
to ‘unblock’ the original thread. How can I block the original thread (when it needs the result of executing the routine
), and then unblock it when interpretation of the child routine is complete?
© Stack Overflow or respective owner