summaryrefslogtreecommitdiff
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
parentb1f2c335e65ef1e711879412ea0f7fbca93b7a15 (diff)
downloadefl-e8c396a6e2aae0f9da189930d0c55cd3d2500d58.tar.gz
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
-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 @@
-#include <unistd.h>
-#include <signal.h>
+#ifdef _WIN32
+# include <stdio.h>
+# include <windows.h>
+# include <process.h>
+
+unsigned int
+_timeout(void *arg)
+{
+ int s (int)arg;
+ Sleep(s * 1000);
+ _Exit(-1);
+ _endthreadex(0);
+ return 0;
+}
+
+void
+timeout_init(int seconds)
+{
+ unsigned int id;
+ _beginthreadex( NULL, 0, _timeout, (void *)seconds, 0, &id);
+}
+#else
+# include <unistd.h>
+# include <signal.h>
static void
_timeout(int val)
@@ -14,3 +36,4 @@ timeout_init(int seconds)
signal(SIGALRM, _timeout);
alarm(seconds);
}
+#endif