473,405 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Raising Events; Halting Execution

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?

Nov 15 '05 #1
1 1547
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?


Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: john bailo | last post by:
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...
4
by: Chris | last post by:
Hi, I followed the the aricle http://support.microsoft.com/default.aspx?scid=kb;en-us;321525 and was able to execute a dts package in vb.net. I replaced all the "Console.WriteLine" with "msgbox"....
117
by: Peter Olcott | last post by:
www.halting-problem.com
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
0
by: Gregory Khrapunovich | last post by:
Hi, I have a menu that generates "Click" events and handlers for the events. Now I need to raise one of these events programmatically. Calling the handler directly is not the same because it...
4
by: Marcel van der Gragt | last post by:
Hi All, I'm I correct that you cannot raise events in the New (or constructor) procedure? Marcel
4
by: Dave A | last post by:
I am developing a somewhat complex component at the moment and coincidently I am also reading the Framework Design Guidelines book. After reading the section about event raising I have re-written...
2
by: Gman | last post by:
Hi, I have created a usercontrol, a grid control essentially. Within it I have a class: clsGridRecord. I have coded the events such that when a user clicks on the grid, say, the events occur on...
3
by: =?Utf-8?B?THVib21pcg==?= | last post by:
Hi, I have an app with the main thread and one additional thread. In the main thread I defined an event handler MyHandler, the function for raisin this event OnMyEvent and the function for...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.