[英]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; 有人可以告诉我,当工作者thead正常返回并终止时,是否保证成员变量的可见性; 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
. 后螺纹t2
检测到线程t1
已经终止,通过t1.isAlive()
或t1.join()
在任何写入t1
是对可见光t2
。 See http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4.4 参见http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4.4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.