Delaying for a
specific time interval
To delay a thread for a specific time interval, you use the TClock::DelayFor function. To call Delay For, a thread must have a time instance that specifies the delay time, and a clock to delay on.
To delay the calling thread for 1 hour:
- Instantiate THours and TSystemClock.
- Call DelayFor on the system clock instance with the desired delay time, 1 hour.
The delay returns when the current time on the system clock is at least 1 hour greater than when DelayFor was called. If DelayFor is called 3 hours after the system starts, the delay returns when the current time on the system clock is greater than or equal to 4 hours.
THours delayTime(1);
TSystemClock realTimeClock;
realTimeClock.DelayFor(delayTime);
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.
Generated with WebMaker