Public Member Functions

acstime::Timer Interface Reference

Inheritance diagram for acstime::Timer:
Inheritance graph
[legend]
Collaboration diagram for acstime::Timer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

long schedule (in TimeoutHandler handler, in Epoch start, in Duration period) raises (ACSTimeError::ArgErrorEx)
void cancel (in long id) raises (ACSTimeError::InvalidIDEx)

Detailed Description

An interface designed to schedule timeouts for TimeoutHandler instances.


Member Function Documentation

void acstime::Timer::cancel ( in long  id  )  raises (ACSTimeError::InvalidIDEx)

Cancels scheduled timeout(s).

Parameters:
id identifier returned by schedule()
long acstime::Timer::schedule ( in TimeoutHandler  handler,
in Epoch  start,
in Duration  period 
) raises (ACSTimeError::ArgErrorEx)

Schedules timeout(s). When a timeout occurs, the handleTimeout() method of TimeoutHandler is called.

There are two types of timeouts:

  • "one shot" where the period is zero
  • "continuous" where a non-zero period is given

For one shot timers, it is not necessary to call the cancel() method of this interface unless it is desired to cancel the timeout before it occurs. Continuous timeouts will continue to occur until cancel() is called to stop them.

Here is how timeouts are used: The client creates a TimeoutHandler object and passes its reference to schedule() along with start and period. The client must then call ci.run(), i.e. go to sleep. All the work is done in the handleTimeout() method of TimeoutHandler (that is called on each timeout). The client must sleep because there is only one thread on the client-side and it is used to call the TimeoutHandler's handleTimeout() method. This is assuming the usage of a C++ SimpleClient of course. If the "client" just happens to be a component, the sleep is unnecessary.

Parameters:
handler a TimeoutHandler object reference
start epoch at which first timeout is to occur, 0 => use current time plus period
period period at which timeouts are to occur after first, 0 => only first timeout will occur so long as the start time is not also 0
Returns:
identifier to be used in cancel()

The documentation for this interface was generated from the following file: