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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -