[英]Why Android Device Monitor doesn't show my threads?
當我啟動使用多個線程的Android應用程序(它們可以正常工作並運行)時,我在Android Device Monitor中看到的只有11個線程,對於我的應用程序,該線程永遠不會少,也不會更多。
它們被命名為main,GC,Signal Catcher,JDWP,Compiler,ReferenceQueueDaemon,FinalizerDaemon,FinalizerWatchdogDaemon,Binder_1,Binder_2,Thread-6542。
該列表中應該有數十個我自己的線程。 似乎我的線程只是打包在單個線程上,每個線程都會運行一段時間並重復執行。
for (Move m : moves) {
MinMaxThread thread = new MinMaxThread(m, values, color);
thread.run();
threads.add(thread);
}
for (Thread t : threads) {
boolean working = true;
while (working) {
try {
t.join();
working = false;
} catch (InterruptedException e) {
}
}
}
編輯:事實出於某種原因,我使用了run()而不是start()。
使用start()
方法啟動線程,而不是直接調用run()
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.