Android ANR因AsyncTask死机而死机

时间:2013-10-30 07:00:14

标签: android android-asynctask deadlock

这个异步任务似乎陷入僵局,等待着自己。

"AsyncTask #1" prio=5 tid=17 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x423f0540 self=0x50af12d0
  | sysTid=22185 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1353653152
  | schedstat=( 0 0 0 ) utm=0 stm=0 core=1
  at java.lang.Object.wait(Native Method)
  - waiting on <0x424c3f48> (a java.lang.VMThread) held by tid=17 (AsyncTask #1)
  at java.lang.Thread.parkFor(Thread.java:1231)
  at sun.misc.Unsafe.park(Unsafe.java:323)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
  at java.lang.Thread.run(Thread.java:856)

关于为什么会发生这种情况的任何想法? 我通过execute()调用了我的asyncTask;多个AsyncTasks在我的应用程序中并行运行。

1 个答案:

答案 0 :(得分:0)

这不是僵局。线程“停放”等待运行。它正在等待拥有的内部锁。看到线程处于这种状态是正常的。