There are several threads working on a task. Once the thread is successful, the entire thread must be canceled since the work is done. How can I cancel other threads as soon as one thread completes successfully? Who will call pthread_cancel ()and how does a successful thread report mainor the thread that generated it (return value?).
UPDATE
I do not want to just call exit, because now I want to get some control. For example, after the threads are canceled, I will process the result on a successful thread and, possibly, do some additional processing, or just want the process to work for some additional work.
source
share