summaryrefslogtreecommitdiff
path: root/src/lib
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
parentf8b262037f4f9b845eea6546f0239f37003d9be6 (diff)
downloadefl-71f7d01b6c4111dc99212e536be029d2442f0bba.tar.gz
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')
-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 @@
#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;
}
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'
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'],