android - Is Java Thread getId() thread-safe? -
as question title says, thread.getid()
thread-safe? had problem whilst multithreading , solution remove getid()
call making thread hang.
yes, it's entirely thread-safe. full implementation in jdk8 is:
public long getid() { return tid; }
tid
initialized once during construction of thread
object , never changed afterward.
if there problem in code removing solved, doing id once had it, not getting id.
Comments
Post a Comment