0
Why thread join is needed after blocking call of future.get
Hi If I am not wrong , we need to join thread object so that main thread wait for thread to get completed. Without doing so, exit will be bad exit. Also, future.get() is a blocking call and will wait until thread function is completed. With these two statement , I thought we don't need to join thread if we have used future.get(). Is this correct? If not , why? If yes, why below code has issue if I comment t.join() line in main function? https://sololearn.com/compiler-playground/cFn1Tvsfe4dm/?ref=app
4 Respuestas
+ 2
get does not handle cleanup.
+ 1
the thread object have to be destructed. it have to be joined for it to happen.
0
Sounds good. What actually cleanup does? Just curious to know. Is it relayed to pcb (process control board) data management taken care by OS?