RtTimer Constructor (Clock, RtTimerCallback, Object, Int32, Int32)

Initializes a new instance of the IntervalZero.Threading.RtTimer class with an infinite period and an infinite due time, using the newly created RtTimerCallback.

IMPORTANT: This constructor has been deprecated. It will be removed in a future release.

Namespace:  IntervalZero.MaxRT.wRTOS.RtApi.Threading
Assembly:  IntervalZero.MaxRT.wRTOS (in IntervalZero.MaxRT.wRTOS.dll) Version: 1.0.0.0 (File version: 1.0.1)

Syntax

Copy
public RtTimer(
    Clock clock,
    RtTimerCallback callback,
    Object context,
    int dueTime,
    int period
)

Parameters

clock

Type: IntervalZero.MaxRT.wRTOS.RtApi.Threading.Clock
A clock identifier as defined below in the Remarks section.

callback

Type: IntervalZero.MaxRT.wRTOS.RtApi.Threading.RtTimerCallback
A System.Threading.TimerCallback delegate representing a method to be executed.

context

Type: System.Object
A pointer to a context to be passed into the callback function. To ensure that any changes in the callback function are global, the parameter should be a reference type, such as a class.

dueTime

Type: System.Int32
The amount of time to delay before callback is invoked. Specify System.Threading.Timeout.Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. Expiration is calculated relative to the current value of the clock associated with the timer at creation. The clock is specified in 100ns units.

period

Type: System.Int32
The time interval between invocations of callback. Specify System.Threading.Timeout.Infinite to disable periodic signaling. The clock is specified in 100ns units. See the comments section below for an explanation of "period" behavior.

Remarks

Allocates a new timer object and returns a handle to it. Legal clock values are:

The timer routine will run as a separate handling thread. The "callback" and "context" perameters are used to control the creation of the handler thread.

To run a different handling routine/context, a new RtTimer object must be created.

In addition to creating the timer object and timer callback this function also sets the relative expiration time and repeat interval for the specified timer. If the repeat interval is non-zero then, after the first expiration, the timer will repeatedly expire at the specified interval. If the repeat interval pointer is NULL, then the timer will expire only once (i.e., it is a "one-shot" timer). Likewise, a non-NULL interval pointer may be passed in, with its value set to zero, for a one-shot timer.

Upon each expiration of the timer, the handling thread is signaled to indicate the expiration, and the specified handling routine is run. The timer signals expirations only on the wRTOS timer interrupt boundaries. The wRTOS timer interval will be rounded up to the wRTOS HAL timer resolution. The highest wRTOS timer resolution is 1 ms. The behavior of the pInterval parameter is as follows:

See Also: