While I was going through the source code of andorid.os.HandlerThread class, I found that Process.myTid() was being used as Thread ID.
I searched it a bit and found this helpful answer, now I understand what is myTid and what's the difference between myTid & Thread.getId().
Here is my question;
WHY we need to get the ID from
Process.myTid()? Why not useThread.getId()?
@Override
public void run() {
mTid = Process.myTid();
Looper.prepare();
synchronized (this) {
mLooper = Looper.myLooper();
notifyAll();
}
Process.setThreadPriority(mPriority);
onLooperPrepared();
Looper.loop();
mTid = -1;
}