简体   繁体   中英

Variable visibility when thread terminates

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM