LWUIT Deadlock (lwuit dialog VS System dialog)
Posted
by Ramps
on Stack Overflow
See other posts from Stack Overflow
or by Ramps
Published on 2010-04-26T15:51:36Z
Indexed on
2010/04/26
15:53 UTC
Read the original article
Hit count: 480
Hi,
I have a deadlock problem when I try to make some I/O operations that needs user permission. When user click the button I start a new thread which is responsible for performing IO operations, and I display lwuit "please wait" dialog. Dialog is dismissed by IO thread from callback method. Problem is that, when system dialog appears (asking for user permission ) on top of lwuit dialog - deadlock occurs. I assume that this is because dialog.show() method blocks main thread (EDT), so it's impossible to dismiss system dialog, when lwuit dialog is behind it. Anyone managed to solve this problem?
Here is the simplified code, hope it is clear enough:
protected void actionPerformed(ActionEvent evt, int id) {
switch (id) {
case ID_FRIEND:
MyRunnableWithIoOperation r = new MyRunnableWithIoOperation(this);
new Thread(r).start(); //run the thread performing IO operations
Command cmd = mWaitDialog.showDialog(); // show the "please wait" dialog
...//handle cancel
}//end switch
}
/* method called from MyRunnableWithIoOperation, when operation finished*/
public void myCallbackMethod(){
mWaitDialog.dispose(); //
}
I tried to start my IO thread by calling Display.getInstance().invokeAndBlock( r ), but with no luck. In such case, my "wait dialog" doesn't show up.
© Stack Overflow or respective owner