View Single Post
Old Mar 29th, 2008, 11:58 PM   #8
Jimbo
Expert Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 706
Rep Power: 3 Jimbo is on a distinguished road
Re: scheduled events

If you know the time you want it to fire at, you can sleep the thread for how long it takes to reach that time. Something along the lines of this pseudo-code:
DateTime target = "sometime";
Thread.Sleep(target - DateTime.Now);
// do your task

At work, we have a tool which basically runs on a timer every 15 seconds, checks an XML file to see if any of the tasks listed are due to run, and checks if any tasks have been added, then sleeps again. So, the polling is also a feasible design, give or take a few seconds.
__________________
<insert disclaimer here>
<insert shameless plug for Visual Studio here>
Jimbo is offline   Reply With Quote