AsyncTask中的Android ANR死锁

问题描述 投票:3回答:1

此异步任务似乎在等待自身时处于死锁状态。

"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在我的应用程序中并行运行。

android android-asynctask deadlock
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.