Reputation: 7
Could somebody please tell me whether or not the visibility of member variables is guaranteed when a worker thead returns and terminates normally; is a volatile write/read sequence still required in order to guarantee visibility?
Upvotes: 0
Views: 48
Reputation: 19682
After thread t2
detects that thread t1
has terminated, through t1.isAlive()
or t1.join()
, any writes in t1
is visible to t2
. See http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4.4
Upvotes: 1