Passive waiting
hi
i have a time axis implemented by ArrayList. There are a nodes, sorted by time of execution. I want to execute some code, when real time is equal (or greater) with Node.Time
I dont want to wait for time by acitve waitng - something like this>
//ArrayList queue
| |
while (realTime >= Node(queue[0]).Time); /* acitive waitng */ Node(queue[0]).execute();
|
how can i run it with passive waiting?
thanks for your ideas
[702 byte] By [
gibic] at [2007-12-16]
I agree - you definitely don't want to "busy wait". There are a number of timers in the .NET Framework depending on your needs. Given that I don't know your application requirements, you'll have to look at the classes and determine which one is most appropriate:
System.Timers.Timer
System.Threading.Timer
System.Windows.Forms.Timer
This discussion (http://msdn2.microsoft.com/library/tb9yt5e6(en-us,vs.80).aspx) should help you in making your decision.