multithreading - Android: AsyncTask how to use wait/notify -
is possible call wait & notify inside asynctask? far, tried use them block asynctask forever. how can overcome this? usage is: have camera frame generated, , want send server continously however, want make better
while( true){ if (frameavaialble){ send(frame) } }
which drains useless cpu power.
you can try conditionvariable
, http://developer.android.com/reference/android/os/conditionvariable.html
private conditionvariable mcondition = new conditionvariable(false); while( true ){ mcondition.block(); send(frame) } //other code frameavaialble = true; mcondition.open();
Comments
Post a Comment