If you can do with Java solution, then on Java side after calling handler.sendMessage() call wait() & once the dialog is dismissed call notify() (of course making sure to wait() & notify() on the same object). Alternatively you could use CyclicBarrier or CountDownLatch in the java.util.concurrent package. Hope that helps.
Regards, Sudheer On Fri, Aug 19, 2011 at 5:40 PM, Chris Stratton <[email protected]> wrote: > On Monday, August 9, 2010 10:53:37 AM UTC-4, AlreadyAMember wrote: >> >> During this loop in C " in case of an error" I would like to >> "callback" the java UI thread and pop up a dialog from C , the KEY is >> C has to block and wait. >> So if I create a thread and set up a handler in Java to show the >> DIalog the the native C code won't block. I have also looked in to >> Loopers Thinking that it could be helpful to block the C code. >> >> Now of course I could be naive and write a while(wait) in c and as >> soon as dialog is closed I can make a native call from java and set >> the wait to false. >> But that is just not cool. >> > > Actually that is approximately the right idea, only it would be better if > the waiting thread could simply ask the kernel scheduler not to run it until > the wait condition is satisfied, by calling a kernel function that will > block until that is the case. A semaphore is a classic operating system > feature for accomplishing that. A method for accomplishing nearly as much > without requiring as much understanding of operating system services would > be to just put a substantial sleep in the loop. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

