[mono-android] waiting for result from runonuithread

Martyn Wendon Martyn.Wendon at TCSJOHNHUXLEY.COM
Thu Nov 17 04:39:05 EST 2011


I have a background thread that occasionally does something with Views,
so I have this executing using runonuithread like so:

 

bool success = false;

RunOnUiThread(() => success = ExecuteRemoteCommand(command, parameter));

 

 

I need to wait for the result from the ExecuteRemoteCommand before
continuing (it doesn't matter that this is blocking).

 

What is the best way to do that?

 

I thought of spinning a While loop like:

 

int success = 0;

RunOnUiThread(() => success = ExecuteRemoteCommand(command, parameter));

 

 

while (success ==0)

{

Thread.Sleep(1000);

}

 

....and making ExecuteRemoteCommand return <> 0 instead of true/false.

 

Is there a better way?

 

 

Thanks,

 

Martyn


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
______________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodroid/attachments/20111117/ae96448e/attachment.html 


More information about the Monodroid mailing list