Skip to content

win32: timer: use threadpoolapiset.h

Thomas Guillem requested to merge tguillem/vlc:win32-timer into master

New API: https://docs.microsoft.com/en-us/windows/win32/procthread/thread-pool-api

This avoid one allocation (that can fail) in vlc_timer_schedule() (that was handled with a call to abort()).

One remark from the documentation: "If the due time specified by pftDueTime is relative, the time that the system spends in sleep or hibernation does not count toward the expiration of the timer. The timer is signaled when the cumulative amount of elapsed time the system spends in the waking state equals the timer's relative due time or period. If the due time specified by pftDueTime is absolute, the time that the system spends in sleep or hibernation does count toward the expiration of the timer. If the timer expires while the system is sleeping, the timer is signaled immediately when the system wakes."

For that reason, the vlc_timer API always use a relative time in SetThreadpoolTimer() and vlc_timer absolute times are substracted with vlc_tick_now().

Merge request reports