Re: How Thread.currentThread() in java work behind the scene?

2019-03-28 Thread 'Carl Mastrangelo' via mechanical-sympathy
Thread.currentThread is a compiler intrinsic, and is not actually a native call. If you look at the JVM source, you can see it's identified in vmSymbols.hpp, and linked (eventually) to this implementation:

Re: How Thread.currentThread() in java work behind the scene?

2019-03-26 Thread Alex Blewitt
Every native operating system has some form of thread identifier which can be acquired by calling e.g. pthread_self(). The thread data structure stored in the thread’s local area has more information (e.g. the limits of the current tlab) and the associated Java thread object. For efficiency in