如何获得Android的线程ID?线程、如何获得、Android、ID

由网友(  灬ˊ辷桷落﹑彽調)分享简介:这code抛出给定的主题不存在当我尝试使用它在一个线程异常:android.os.Process.getThreadPriority((INT)Thread.currentThread()的getId()));同上,如果我尝试使用Process.setThreadPriority,使用java类线程ID。我也注意到,这...

这code抛出给定的主题不存在当我尝试使用它在一个线程异常:

  android.os.Process.getThreadPriority((INT)Thread.currentThread()的getId()));
 

同上,如果我尝试使用Process.setThreadPriority,使用java类线程ID。我也注意到,这种不匹配在调试器中显示的线程ID。我如何获取Android特定线程ID,才能使用此API?

解决方案

  android.os.Process.getThreadPriority(android.os.Process.myTid());
 
Android的线程和线程池

有关进一步参考

http://developer.android.com/reference/android/os/Process.html#myTid()

This code throws a "Given thread does not exist" exception when I try to use it in a thread:

android.os.Process.getThreadPriority((int) Thread.currentThread().getId()));

Ditto if I try to use Process.setThreadPriority, using the java class Thread id. I've also noticed that this does not match the thread id displayed in the debugger. How do I get the Android specific thread id, in order to use this API?

解决方案

android.os.Process.getThreadPriority(android.os.Process.myTid());

For further reference

http://developer.android.com/reference/android/os/Process.html#myTid()

阅读全文

相关推荐

最新文章