Hi - I have the following code that kicks of a new thread (the thread is
designed to check for internet reachability) and at the end check I want it
to call a method on the main UI thread. Two questions really...

1. Is the code safe from memory-leaks, in particular the way my "EndCheck"
method is called from within the thread?

2. If during the process I wish to terminate the busy new thread, how can I
safely do that?

-----------

public void InternetCheckShowBusyView(string sMessage)
{
        Thread thread = new System.Threading.Thread(DoCheckInternet as
ThreadStart);
        thread.Start();
}               

[Export("DoCheckInternet")]
void DoCheckInternet()
{
        using (var pool = new NSAutoreleasePool())
        {
                bool bResult = MyInternetCheckMethod();
                InvokeOnMainThread(EndCheck);
        }
}
                
[Export("EndCheck")]
void EndCheck()
{
        // Do whatever I want...
}


--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/2-Threading-Questions-tp3990347p3990347.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to