android - ANR's frameDelay(); -


getting anr's when framedelay(); being called. can on code , see going wrong stumped!

p.s stackoverflow details needed silly input box error correction.

public final class drawthread extends thread {      private boolean mpause = false;      private boolean mrun = true;      @override     public void run() {         while (mrun) {              framedelay();              canvas canvas = null;              waitforbitmap();              try {                  while (mrun && mpause) {                     sleep(100);                 }                  canvas = surfaceholder.lockcanvas(null);                  if (canvas != null) {                     synchronized (surfaceholder) {                         if (mrun) {                             controller.draw();                              canvas.drawcolor(color.ltgray);                              canvas.drawbitmap(mbitmap, panhelper.mrectsrc,                                     panhelper.mrectdst, paint);                         }                     }                 }             } catch (interruptedexception e) {             } {                 if (canvas != null) {                     surfaceholder.unlockcanvasandpost(canvas);                 }             }         }     }      private void framedelay() {         long = system.currenttimemillis();         long delay = frame_delay + lasttime - now;         if (delay > 0) {             try {                 sleep(delay);             } catch (interruptedexception e) {             }         }         lasttime = now;     }      private void waitforbitmap() {         while (mbitmap == null) {             if (!mrun) {                 log.d(activity.app_name, "break - waitforbitmap()");                 break;             }             try {                 sleep(100);             } catch (interruptedexception e) {                 e.printstacktrace();             }         }     }  dalvik threads: (mutexes: tll=0 tsl=0 tscl=0 ghl=0) "main" prio=5 tid=1 native | group="main" scount=1 dscount=0 obj=0x40a0a460 self=0xee27f0 | systid=3857 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=1074427016 | schedstat=( 1540000000 2010000000 2336 ) utm=129 stm=25 core=0 @ libcore.io.posix.fsync(native method) @ libcore.io.blockguardos.fsync(blockguardos.java:97) @ java.io.filedescriptor.sync(filedescriptor.java:71) @ android.os.fileutils.sync(fileutils.java:111) @ android.app.sharedpreferencesimpl.writetofile(sharedpreferencesimpl.java:577) @ android.app.sharedpreferencesimpl.access$800(sharedpreferencesimpl.java:48) @ android.app.sharedpreferencesimpl$2.run(sharedpreferencesimpl.java:491) @ android.app.sharedpreferencesimpl.enqueuediskwrite(sharedpreferencesimpl.java:512) @ android.app.sharedpreferencesimpl.access$100(sharedpreferencesimpl.java:48) @ android.app.sharedpreferencesimpl$editorimpl.commit(sharedpreferencesimpl.java:434) @ com.pad.android.xappad.adcontroller.initialized((null):-1) @ com.pad.android.xappad.adtask.onpostexecute((null):-1) @ android.os.asynctask.finish(asynctask.java:602) @ android.os.asynctask.access$600(asynctask.java:156) @ android.os.asynctask$internalhandler.handlemessage(asynctask.java:615) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:4424) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:784) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:551) @ dalvik.system.nativestart.main(native method)  "thread-357" prio=5 tid=23 suspended | group="main" scount=1 dscount=0 obj=0x40fb91b8 self=0x1063c20 | systid=3953 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=17497520 | schedstat=( 3940000000 2040000000 10848 ) utm=366 stm=28 core=0 @ java.lang.vmthread.sleep(native method) @ java.lang.thread.sleep(thread.java:1031) @ java.lang.thread.sleep(thread.java:1013) @ com.mypackage.framedelay(surface.java:290) @ com.mypackage.surface.surface$drawthread.run(surface.java:250)  "asynctask #5" prio=5 tid=22 wait | group="main" scount=1 dscount=0 obj=0x413c9c78 self=0x10d1178 | systid=3952 nice=10 sched=0/0 cgrp=[no-cpu-subsys] handle=17722864 | schedstat=( 90000000 830000000 344 ) utm=8 stm=1 core=0 @ java.lang.object.wait(native method) - waiting on <0x413c9dd0> (a java.lang.vmthread) held tid=22 (asynctask #5) @ java.lang.thread.parkfor(thread.java:1231) @ sun.misc.unsafe.park(unsafe.java:323) @ java.util.concurrent.locks.locksupport.park(locksupport.java:157) @ java.util.concurrent.locks.abstractqueuedsynchronizer$conditionobject.await(abstractqueuedsynchronizer.java:2022) @ java.util.concurrent.linkedblockingqueue.take(linkedblockingqueue.java:413) @ java.util.concurrent.threadpoolexecutor.gettask(threadpoolexecutor.java:1009) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1069) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) @ java.lang.thread.run(thread.java:856)  "asynctask #4" prio=5 tid=21 wait | group="main" scount=1 dscount=0 obj=0x413f81f8 self=0x1104568 | systid=3951 nice=10 sched=0/0 cgrp=[no-cpu-subsys] handle=17666776 | schedstat=( 90000000 880000000 330 ) utm=8 stm=1 core=0 @ java.lang.object.wait(native method) - waiting on <0x413f8318> (a java.lang.vmthread) held tid=21 (asynctask #4) @ java.lang.thread.parkfor(thread.java:1231) @ sun.misc.unsafe.park(unsafe.java:323) @ java.util.concurrent.locks.locksupport.park(locksupport.java:157) @ java.util.concurrent.locks.abstractqueuedsynchronizer$conditionobject.await(abstractqueuedsynchronizer.java:2022) @ java.util.concurrent.linkedblockingqueue.take(linkedblockingqueue.java:413) @ java.util.concurrent.threadpoolexecutor.gettask(threadpoolexecutor.java:1009) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1069) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) @ java.lang.thread.run(thread.java:856)  "asynctask #3" prio=5 tid=19 wait | group="main" scount=1 dscount=0 obj=0x4138b5a8 self=0x10d0be8 | systid=3942 nice=10 sched=0/0 cgrp=[no-cpu-subsys] handle=17633336 | schedstat=( 0 10000000 4 ) utm=0 stm=0 core=0 @ java.lang.object.wait(native method) - waiting on <0x413dd588> (a java.lang.vmthread) held tid=19 (asynctask #3) @ java.lang.thread.parkfor(thread.java:1231) @ sun.misc.unsafe.park(unsafe.java:323) @ java.util.concurrent.locks.locksupport.park(locksupport.java:157) @ java.util.concurrent.locks.abstractqueuedsynchronizer$conditionobject.await(abstractqueuedsynchronizer.java:2022) @ java.util.concurrent.linkedblockingqueue.take(linkedblockingqueue.java:413) @ java.util.concurrent.threadpoolexecutor.gettask(threadpoolexecutor.java:1009) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1069) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) @ java.lang.thread.run(thread.java:856)  "pool-2-thread-1" prio=5 tid=13 suspended | group="main" scount=1 dscount=0 obj=0x413bdae8 self=0x10adf78 | systid=3938 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=17314176 | schedstat=( 20000000 30000000 44 ) utm=1 stm=1 core=0 @ libcore.io.posix.fstat(native method) @ libcore.io.forwardingos.fstat(forwardingos.java:50) @ libcore.io.iobridge.open(iobridge.java:394) @ java.io.fileoutputstream.<init>(fileoutputstream.java:88) @ java.io.fileoutputstream.<init>(fileoutputstream.java:73) @ android.app.sharedpreferencesimpl.createfileoutputstream(sharedpreferencesimpl.java:523) @ android.app.sharedpreferencesimpl.writetofile(sharedpreferencesimpl.java:571) @ android.app.sharedpreferencesimpl.access$800(sharedpreferencesimpl.java:48) @ android.app.sharedpreferencesimpl$2.run(sharedpreferencesimpl.java:491) @ android.app.sharedpreferencesimpl.enqueuediskwrite(sharedpreferencesimpl.java:512) @ android.app.sharedpreferencesimpl.access$100(sharedpreferencesimpl.java:48) @ android.app.sharedpreferencesimpl$editorimpl.commit(sharedpreferencesimpl.java:434) @ com.adwhirl.adwhirlmanager.fetchconfig(adwhirlmanager.java:253) @ com.adwhirl.adwhirllayout$initrunnable.run(adwhirllayout.java:406) @ java.util.concurrent.executors$runnableadapter.call(executors.java:442) @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:305) @ java.util.concurrent.futuretask.run(futuretask.java:137) @ java.util.concurrent.scheduledthreadpoolexecutor$scheduledfuturetask.access$201(scheduledthreadpoolexecutor.java:150) @ java.util.concurrent.scheduledthreadpoolexecutor$scheduledfuturetask.run(scheduledthreadpoolexecutor.java:264) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1076) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) @ java.lang.thread.run(thread.java:856)  "asynctask #2" prio=5 tid=17 wait | group="main" scount=1 dscount=0 obj=0x413ddf80 self=0x10dea50 | systid=3934 nice=10 sched=0/0 cgrp=[no-cpu-subsys] handle=17823464 | schedstat=( 10000000 280000000 11 ) utm=1 stm=0 core=0 @ java.lang.object.wait(native method) - waiting on <0x413de0a0> (a java.lang.vmthread) held tid=17 (asynctask #2) @ java.lang.thread.parkfor(thread.java:1231) @ sun.misc.unsafe.park(unsafe.java:323) @ java.util.concurrent.locks.locksupport.park(locksupport.java:157) @ java.util.concurrent.locks.abstractqueuedsynchronizer$conditionobject.await(abstractqueuedsynchronizer.java:2022) @ java.util.concurrent.linkedblockingqueue.take(linkedblockingqueue.java:413) @ java.util.concurrent.threadpoolexecutor.gettask(threadpoolexecutor.java:1009) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1069) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) @ java.lang.thread.run(thread.java:856)  "asynctask #1" prio=5 tid=15 wait | group="main" scount=1 dscount=0 obj=0x413c5e40 self=0x10db498 | systid=3930 nice=10 sched=0/0 cgrp=[no-cpu-subsys] handle=17676520 | schedstat=( 10000000 210000000 41 ) utm=1 stm=0 core=0 @ java.lang.object.wait(native method) - waiting on <0x413c5fd8> (a java.lang.vmthread) held tid=15 (asynctask #1) @ java.lang.thread.parkfor(thread.java:1231) @ sun.misc.unsafe.park(unsafe.java:323) @ java.util.concurrent.locks.locksupport.park(locksupport.java:157) @ java.util.concurrent.locks.abstractqueuedsynchronizer$conditionobject.await(abstractqueuedsynchronizer.java:2022) @ java.util.concurrent.linkedblockingqueue.take(linkedblockingqueue.java:413) @ java.util.concurrent.threadpoolexecutor.gettask(threadpoolexecutor.java:1009) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1069) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) @ java.lang.thread.run(thread.java:856)  "cookiesyncmanager" prio=5 tid=14 native | group="main" scount=1 dscount=0 obj=0x413c3b20 self=0x10ad270 | systid=3928 nice=10 sched=0/0 cgrp=[no-cpu-subsys] handle=16311256 | schedstat=( 0 0 7 ) utm=0 stm=0 core=0 @ android.os.messagequeue.nativepollonce(native method) @ android.os.messagequeue.next(messagequeue.java:118) @ android.os.looper.loop(looper.java:118) @ android.webkit.websyncmanager.run(websyncmanager.java:90) @ android.webkit.cookiesyncmanager.run(cookiesyncmanager.java:61) @ java.lang.thread.run(thread.java:856)  "webviewcorethread" prio=5 tid=12 native | group="main" scount=1 dscount=0 obj=0x413ba6f8 self=0x105ff70 | systid=3926 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=17511280 | schedstat=( 140000000 300000000 318 ) utm=13 stm=1 core=0 @ android... 


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -