summaryrefslogtreecommitdiff
path: root/src/generic
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-07-14 14:23:49 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-07-14 14:23:49 +0900
commite8c396a6e2aae0f9da189930d0c55cd3d2500d58 (patch)
treed456b569dfae8f69edc89c42186d083b5d847549 /src/generic
parentb1f2c335e65ef1e711879412ea0f7fbca93b7a15 (diff)
evas generic loaders fix timeout on windows where no alarm exists
this uses a thread - to do the same. based on code vtorri put in T3790 this should fix T3790
Diffstat (limited to 'src/generic')
-rw-r--r--src/generic/evas/common/timeout.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/generic/evas/common/timeout.c b/src/generic/evas/common/timeout.c
index 6d52aa9609..7737bad41f 100644
--- a/src/generic/evas/common/timeout.c
+++ b/src/generic/evas/common/timeout.c
@@ -1,5 +1,27 @@
1#include <unistd.h> 1#ifdef _WIN32
2#include <signal.h> 2# include <stdio.h>
3# include <windows.h>
4# include <process.h>
5
6unsigned int
7_timeout(void *arg)
8{
9 int s (int)arg;
10 Sleep(s * 1000);
11 _Exit(-1);
12 _endthreadex(0);
13 return 0;
14}
15
16void
17timeout_init(int seconds)
18{
19 unsigned int id;
20 _beginthreadex( NULL, 0, _timeout, (void *)seconds, 0, &id);
21}
22#else
23# include <unistd.h>
24# include <signal.h>
3 25
4static void 26static void
5_timeout(int val) 27_timeout(int val)
@@ -14,3 +36,4 @@ timeout_init(int seconds)
14 signal(SIGALRM, _timeout); 36 signal(SIGALRM, _timeout);
15 alarm(seconds); 37 alarm(seconds);
16} 38}
39#endif