osCreateTimer function
Declaration:
HANDLE osCreateTimer(
  SYSNAME Name,
  BOOL ManualReset
);
Parameters:
Name

The unique identifier for the timer object (may be NULL).

ManualReset

Specifies the reset mode. If set to TRUE, a manual-reset timer is created; otherwise, an auto-reset timer is initialized (refer to the Description section for further details).

Return value:

Returns a valid handle to the created timer object upon success, or NULL_HANDLE if the operation fails. To retrieve extended error information, call the osGetLastError function.

Description:

This function initializes and creates a new timer object.

Timer objects provide mechanisms for task synchronization relative to specific time points or intervals. Functionally similar to events, timers transition to the signaled state whenever a specified duration elapses and return to the non-signaled state upon being reset.

An optional name may be assigned during creation, allowing other tasks to obtain a handle to the timer via the osOpenTimer function. When a timer is no longer required, its handle should be released using osCloseHandle. The system destroys the timer object only after all tasks have closed their respective handles. For further details, refer to the System Objects Management section.

To optimize memory footprint, if the application does not utilize any osOpen* functions, the kernel ignores object names and excludes the name management code from the build. This reduces the final size of the output code. See the System Objects Management section for more information regarding object naming and opening conventions.

The behavior of the timer-either manual-reset or auto-reset-is determined at the time of creation. For a manual-reset timer, a new timing cycle must be explicitly initiated using osResetTimer. Conversely, an auto-reset timer automatically begins a new cycle immediately following the completion of the previous one. If multiple tasks are waiting on an auto-reset timer, only one task will be released at the end of each cycle.

For additional details regarding timer behavior and configuration, please refer to the Timer Objects section.

This function is available only when the OS_USE_TIMER configuration constant is set to 1.

Version:1.0
Header file:OS_Timer.h (include OS_API.h)
See also: BOOL, FALSE, HANDLE, NULL, NULL_HANDLE, OS_OPEN_TIMER_FUNC, osCloseHandle, osOpenTimer, osGetLastError, osSetTimer, SYSNAME, system objects management, timers, TRUE
SpaceShadow documentation