473,399 Members | 3,656 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,399 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?

Jul 21 '05 #1
1 1467
If you didn't mind the thread being unresponsive you could put the thread to
sleep in a loop.

Suppose that your FileWatcher code set a property when the file was
available, say _FileAvailable
then on your waiting thread you have the loop (in VB.net)

While Not _FileAvailable
system.threading.thread.currentthread.sleep(500)
end while
' Code to run then the file is found

Hope this helps

Andrew Fell-Gordon
Sound Technologies Ltd
Jul 21 '05 #2

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

Similar topics

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
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...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.