Thank you for insightful answers! I have now found the reason for my problem and feel kinda stupid for not thinking about it. The UI thread makes a call to the engine which spawns a thread and calls queryUserThread, however, the call to the engine is still synchronous and the UI thread waits for a reply. So when i try to startActivity, the UI thread is busy waiting for it's function call and thus a deadlock is created.
> You didn't include information on what s_Semaphore is, but I'm guessing > it's from java.concurrent. This is correct. > Although I'm not too familiar with this package, the docs say this: > > http://download.oracle.com/javase/1.5.0/docs/api/java/util/concurrent... > > > Conceptually, a semaphore maintains a set of permits. Each acquire() > > blocks if necessary until a permit is available, and then takes it. > > If you constructed the semaphore with "1" for "permits", then what you > are seeing is as designed - the semaphore will block on second acquire. > It's not reentrant, the way synchronized blocks are (which can be owned > multiple times by the same thread). That's what I did and also what I intended. The call to queryUserSave SHOULD block until onQueryUserSaveResult is called (this is just a worker thread, not the UI thread). > - Rewrite the code using only the language's built-in synchronization I should have mentioned I also tried this with the same result. -- 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

