Setting a delay

Typically, you set a delay on a clock to prevent a thread from being processed until a certain time. When you set a delay, the thread is delayed until the specified time is in the clock's past (directionally less than the clock time) or until the delay is canceled. There are two types of delays:

When a delay returns, use the time returned from TClock::Now to determine what to do next. For example, if the flow of time has reversed direction, you might want to set another delay and not continue processing until time is flowing forward again; however, if the flow of time has not reversed, processing can continue normally. You have to call Now to determine the direction that time is flowing. Now is normally the fastest clock function and returns the most accurate time.

You should never make assumptions about the time because it can be affected by many factors. For example:

For information about one way to handle the second case, see "Programming around time flowing backward" on page 86.


[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