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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -