As the title described, you may answer that it can be gotten by JNI invoking (java.lang.Thread.currentThread().getId()). But actually it did not work because in Android 5.0 JNI invoking may cause "java.lang.StackOverflowError" (described in java.lang.StackOverflow Error for Android L preview running art). So I create a linux thread by calling pthread_create and try to make JNI invoking in this thread. But how to get pre-thread object(java.lang.Thread) before I create the new linux thread for I need to do something with that pre-thread. Because java thread dose not map the linux thread, so gettid() dose not work too. Is there anybody can help? Sincerely thanks.
Asked
Active
Viewed 745 times
1
-
You need to do what with that 'pre-thread'? – user207421 Sep 28 '15 at 01:31
-
Like getting the stack of it and so on. – Jalen Sep 28 '15 at 01:35
-
The question is the same as how to get nid(Native thread ID) in java? – Jalen Sep 28 '15 at 07:48