On Mon, 24 May 2004 15:53:28 -0700, Bob Jacobs wrote:
Is there a way to explicitly tell .NET to return back to
the original calling thread? I am doing asynchronous
threading and I am trying to figure out if I can (within
the callback after the .EndInvoke) explicitly tell .NET to
go back to the thread from where I called the .BeginInvoke.
Thanks,
Bob
Bob,
If this is a GUI app, then yes - there is a way, sort of :) You can do
something similar to this:
' sub in a form, this is air code - and so syntax may be a little off...
Private Sub AsyncCallback(ByVal ar As IAsyncResult)
' call your end invoke
If Me.InvokeRequired Then
Me.Invoke (New AsyncCallbackDelegate(Me.AsyncCallback), ar)
Else
' Do stuff now that you're back on the ui thread
End If
End Sub
--
Tom Shelton [MVP]