Thread.join() and synchronization?

Is Thread.join() a full synchronization with flushing of caches etc. when performed of the thread beeing joined?

Jon Skeet
people
quotationmark

I think you're asking whether from thread T1 that calls join on T2, code in T1 reading data after the join() will definitely see changes written by T2. If that's the case, then the answer is yes, due to JLS 17.4.4:

The final action in a thread T1 synchronizes-with any action in another thread T2 that detects that T1 has terminated.

T2 may accomplish this by calling T1.isAlive() or T1.join().

and JLS 17.4.5:

All actions in a thread happen-before any other thread successfully returns from a join() on that thread.

people

See more on this question at Stackoverflow