Instead of using different frameworks and noting that you mentioned pthread_join() in your question, you can still achieve the desired effect using POSIX C. To do this, you can use signals to confirm the flow of the parallel task. In this method, you set the signal handler for the defined the user of the signal (for example, t21>), create a set of workflows with various tasks and let them signal their parents when they are completed.
The following program illustrates the attempt. In this example, I use SIGUSR1 to inform the parent thread that some processing has completed. The parent thread remains busy doing some I / O until it is interrupted by the child thread. Please note that for clarity, the error code is not processed.
#include <pthread.h>
The example uses the LinuxThreads signal implementation, which is very different from what POSIX defines. If you are interested in portability or compliance, the above solution should be further reviewed.
alecov
source share