summaryrefslogtreecommitdiff
path: root/src/lib/evil
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2021-09-03 09:10:07 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-09-03 09:10:07 +0100
commit71f7d01b6c4111dc99212e536be029d2442f0bba (patch)
treef13727e30de4e15fe43af23a54f25a03791d1822 /src/lib/evil
parentf8b262037f4f9b845eea6546f0239f37003d9be6 (diff)
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
Diffstat (limited to 'src/lib/evil')
-rw-r--r--src/lib/evil/evil_main.c16
-rw-r--r--src/lib/evil/meson.build3
2 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/evil/evil_main.c b/src/lib/evil/evil_main.c
index 803e47fc30..cd12a69411 100644
--- a/src/lib/evil/evil_main.c
+++ b/src/lib/evil/evil_main.c
@@ -4,8 +4,11 @@
4 4
5#include <stdio.h> 5#include <stdio.h>
6 6
7#include <windows.h>
8
7#include "evil_private.h" 9#include "evil_private.h"
8 10
11static UINT _evil_time_period = 1;
9 12
10static int _evil_init_count = 0; 13static int _evil_init_count = 0;
11 14
@@ -19,10 +22,21 @@ evil_init(void)
19{ 22{
20 LARGE_INTEGER freq; 23 LARGE_INTEGER freq;
21 LARGE_INTEGER count; 24 LARGE_INTEGER count;
25 TIMECAPS tc;
26 MMRESULT res;
22 27
23 if (++_evil_init_count != 1) 28 if (++_evil_init_count != 1)
24 return _evil_init_count; 29 return _evil_init_count;
25 30
31 res = timeGetDevCaps(&tc, sizeof(TIMECAPS));
32 if (res != MMSYSERR_NOERROR)
33 return --_evil_init_count;
34
35 _evil_time_period = tc.wPeriodMin;
36 res = timeBeginPeriod(_evil_time_period);
37 if (res != TIMERR_NOERROR)
38 return --_evil_init_count;
39
26 QueryPerformanceFrequency(&freq); 40 QueryPerformanceFrequency(&freq);
27 41
28 _evil_time_freq = freq.QuadPart; 42 _evil_time_freq = freq.QuadPart;
@@ -52,6 +66,8 @@ evil_shutdown(void)
52 66
53 evil_sockets_shutdown(); 67 evil_sockets_shutdown();
54 68
69 timeEndPeriod(_evil_time_period);
70
55 return _evil_init_count; 71 return _evil_init_count;
56} 72}
57 73
diff --git a/src/lib/evil/meson.build b/src/lib/evil/meson.build
index dc86e6af0b..a29aa5fddf 100644
--- a/src/lib/evil/meson.build
+++ b/src/lib/evil/meson.build
@@ -24,9 +24,10 @@ if target_machine.system() == 'windows'
24 ole32 = cc.find_library('ole32') 24 ole32 = cc.find_library('ole32')
25 ws2_32 = cc.find_library('ws2_32') 25 ws2_32 = cc.find_library('ws2_32')
26 secur32 = cc.find_library('secur32') 26 secur32 = cc.find_library('secur32')
27 winmm = cc.find_library('winmm')
27 uuid = cc.find_library('uuid') 28 uuid = cc.find_library('uuid')
28 29
29 evil_ext_deps += [psapi, ole32, ws2_32, secur32, uuid, regexp] 30 evil_ext_deps += [psapi, ole32, ws2_32, secur32, winmm, uuid, regexp]
30 31
31 evil_lib = library('evil', evil_src, 32 evil_lib = library('evil', evil_src,
32 c_args : [package_c_args, '-DEVIL_BUILD'], 33 c_args : [package_c_args, '-DEVIL_BUILD'],