Syntax
VM_TIMER_ID_PRECISE vm_timer_create_precise(
    VMUINT32 milliseconds, 
    vm_timer_precise_callback timer_procedure, 
    void* user_data
);
ContentsIndex
PreviousUpNext
vm_timer_create_precise
Example
Syntax
VM_TIMER_ID_PRECISE vm_timer_create_precise(
    VMUINT32 milliseconds, 
    vm_timer_precise_callback timer_procedure, 
    void* user_data
);
Description

Creates a precise timer. Once the timer is created, it will fire repeatedly at the interval until the timer is deleted. A precise timer will be stopped when the system gets into the power saving mode. An application is allowed to have up to 10 precise timers. 

The callback functions of both precise and non-precise timers are executed by the same thread. A callback will not be executed until the execution of the previous callback completes.

Parameters
Parameters 
Description 
VMUINT32 milliseconds 
[IN] The timer interval in millisecond. 
vm_timer_precise_callback timer_procedure 
[IN] The callback function that is to be invoked when the timer fires. 
void* user_data 
[IN] The data to be consumed by the callback function. 
Returns

A timer handle. If the timer handle is a positive integer, it means the 

timer is created successfully. Otherwise, a negative integer is returned. 

Refer to VM_TIMER_RESULT for error code, if it fails.

Example
void customer_precise_timer_example_proc(VM_TIMER_ID_PRECISE tid, void* user_data)
{
    static VMINT s_restore_num = 0;
    s_restore_num++;
    if(s_restore_num > 10)
    {
        vm_timer_delete_precise(tid);
    }
}

void customer_run_precise_timer(void)
{
     VM_TIMER_ID_PRECISE timer_id = 0;
     timer_id = vm_timer_create_precise(1000, (vm_timer_precise_callback)customer_precise_timer_example_proc, NULL);
     if(timer_id < 0)
     {
         vm_log_debug("customer_run_timer create timer fail");
     }
}
File

vmtimer.h

Group
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.