When I log the two below thread Ids, they are different.
long threadId = Thread.currentThread().getId();
long threadId2 = android.os.Process.myTid();
But from Android document, they are quite the same:
/**
* Returns the Thread of the caller, that is, the current Thread.
*/
public static native Thread currentThread();
So I assume the first line will returns the id of the caller thread.
then this
/**
* Returns the identifier of the calling thread, which be used with
* {@link #setThreadPriority(int, int)}.
*/
public static final int myTid() {
return Os.gettid();
}
From the comment, it looks like it is also the id of the caller thread (although they use the word 'calling').
They are supposed the same, or am I missing anything? Thanks.