Look at the Asynchronous Programming Overview in Visual Studio 2002
Here's a bit of it:
You can make and complete .NET asynchronous calls in one of the four following ways:
a.. Use Callbacks
Supply the callback delegate when beginning asynchronous calls.
b.. Poll Completed
Poll the returned IAsyncResult.IsCompleted property for completion of calls.
c.. Begin Invoke, End Invoke
Attempt to complete the operation prematurely, thereby blocking until the operation completes.
d.. Begin Invoke, Wait Handle, End Invoke
Wait on IAsyncResult. The difference between this and the previous option is that the client can use time outs to wake up periodically.
With .NET asynchronous programming, the server splits asynchronous operation into its two logical parts: the part that takes input from the client and starts the asynchronous operation, and the part that supplies results of the asynchronous operation to the client. In addition, to the input needed for the asynchronous operation, the first part also takes an AsyncCallback Delegate to be called when the asynchronous operation is completed. The first part returns a waitable object that implements IAsyncResult Interface used by the client to determine the status of the asynchronous operation. The server typically utilizes the waitable object it returned to the client to maintain any state associated with asynchronous operation. The client uses the second part to obtain the results of the asynchronous operation by supplying the waitable object.
"john bailo" <jb****@vestcom.com> wrote in message news:c9******************************@news.teranew s.com...
Suppose I am writing a program that has to execute
as series of steps, but at several of the steps, I want
to wait for external events to occur.
For example ( and this relates to another of my posts ),
say I want to execute a method, then wait for a flag
file. Ok, someone suggested using FileSystemWatcher.
So then, say I do that, how do I make an internal event
halt execution on the main method, wait for the event
to be raised when the file appears and then continue
execution?