VM_TIMER_ID_NON_PRECISE vm_timer_create_non_precise( VMUINT32 milliseconds, vm_timer_non_precise_callback timer_procedure, void* user_data );
VM_TIMER_ID_NON_PRECISE vm_timer_create_non_precise( VMUINT32 milliseconds, vm_timer_non_precise_callback timer_procedure, void* user_data );
Creates a non-precise timer. Once the timer is created, it will fire repeatedly at the interval until the timer is deleted. A non-precise timer will not stop when the system gets into the power saving mode. The non-precise timer can be used to wake the system up. An application is allowed to have up to 10 non-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 |
Description |
|
VMUINT32 milliseconds |
[IN] The timer interval in millisecond. |
|
vm_timer_non_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. |
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 fails.
void customer_non_precise_timer_example_proc(VM_TIMER_ID_NON_PRECISE tid, void* user_data) { static VMINT s_restore_num = 0; s_restore_num++; if(s_restore_num > 10) { vm_timer_delete_non_precise(tid); } } void customer_run_non_precise_timer(void) { VM_TIMER_ID_NON_PRECISE timer_id = 0; timer_id = vm_timer_create_non_precise(1000, (vm_timer_non_precise_callback)customer_non_precise_timer_example_proc, NULL); if(timer_id < 0) { vm_log_debug("customer_run_time create non-precise timer fail!"); } }
vmtimer.h
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.