Evil: improve timer resolution of timers and waiters
Test Plan: running the efl since several months without problem Reviewers: raster Reviewed By: raster Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12289
This commit is contained in:
parent
f8b262037f
commit
71f7d01b6c
|
@ -4,8 +4,11 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "evil_private.h"
|
||||
|
||||
static UINT _evil_time_period = 1;
|
||||
|
||||
static int _evil_init_count = 0;
|
||||
|
||||
|
@ -19,10 +22,21 @@ evil_init(void)
|
|||
{
|
||||
LARGE_INTEGER freq;
|
||||
LARGE_INTEGER count;
|
||||
TIMECAPS tc;
|
||||
MMRESULT res;
|
||||
|
||||
if (++_evil_init_count != 1)
|
||||
return _evil_init_count;
|
||||
|
||||
res = timeGetDevCaps(&tc, sizeof(TIMECAPS));
|
||||
if (res != MMSYSERR_NOERROR)
|
||||
return --_evil_init_count;
|
||||
|
||||
_evil_time_period = tc.wPeriodMin;
|
||||
res = timeBeginPeriod(_evil_time_period);
|
||||
if (res != TIMERR_NOERROR)
|
||||
return --_evil_init_count;
|
||||
|
||||
QueryPerformanceFrequency(&freq);
|
||||
|
||||
_evil_time_freq = freq.QuadPart;
|
||||
|
@ -52,6 +66,8 @@ evil_shutdown(void)
|
|||
|
||||
evil_sockets_shutdown();
|
||||
|
||||
timeEndPeriod(_evil_time_period);
|
||||
|
||||
return _evil_init_count;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,10 @@ if target_machine.system() == 'windows'
|
|||
ole32 = cc.find_library('ole32')
|
||||
ws2_32 = cc.find_library('ws2_32')
|
||||
secur32 = cc.find_library('secur32')
|
||||
winmm = cc.find_library('winmm')
|
||||
uuid = cc.find_library('uuid')
|
||||
|
||||
evil_ext_deps += [psapi, ole32, ws2_32, secur32, uuid, regexp]
|
||||
evil_ext_deps += [psapi, ole32, ws2_32, secur32, winmm, uuid, regexp]
|
||||
|
||||
evil_lib = library('evil', evil_src,
|
||||
c_args : [package_c_args, '-DEVIL_BUILD'],
|
||||
|
|
Loading…
Reference in New Issue