Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Cancelling pthread_join() DOESNT detach target thread?

Cancelling Detach target thread
0
Posted

Cancelling pthread_join() DOESNT detach target thread?

0

Alexander Terekhov wrote: > the standard says: > > “Cancelation Points > > Cancelation points shall occur when a thread is > executing the following functions: > . > . > . > pthread_join()…” > > “If the thread calling pthread_join() is canceled, > then the target thread shall not be detached.” > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > Q) WHY ??? This is, as you guessed below, a requirement for the IMPLEMENTATION. What it means is perhaps a little complicated, and this is one of the reasons that the STANDARD isn’t really intended as general user documentation. Part of the confusion is historical, and would be more obvious to someone familiar with DCE threads, which was an implementation of an early draft of the standard document. Originally, “detach” and “join” were separate operations. “Join” merely allowed a thread to wait until the target was complete. There was no reason that both threads 1 and 2 couldn’t wait for thread 3 to complete. But in order to ensure that system resources

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.