Commit 5d526e63 authored by Filippo Della Betta's avatar Filippo Della Betta Committed by Youness Alaoui

unistd.h is not present on Visual Studio. Replaced usleep with g_usleep to...

unistd.h is not present on Visual Studio. Replaced usleep with g_usleep to support win32 platform as well. Added WSAStartup/WSACleanup on win32
parent 15f92eee
......@@ -42,7 +42,9 @@
#include <stdlib.h>
#include <string.h>
#ifndef G_OS_WIN32
#include <unistd.h>
#endif
GMainLoop *error_loop;
......@@ -67,7 +69,7 @@ mainloop_thread (gpointer data)
{
GMainLoop *loop = data;
usleep (100000);
g_usleep (100000);
g_main_loop_run (loop);
return NULL;
......@@ -188,6 +190,10 @@ int main (void)
GMainLoop *ldmainloop, *rdmainloop;
GThread *ldthread, *rdthread;
#ifdef G_OS_WIN32
WSADATA w;
WSAStartup(0x0202, &w);
#endif
g_type_init ();
#if !GLIB_CHECK_VERSION(2,31,8)
g_thread_init(NULL);
......@@ -341,6 +347,8 @@ int main (void)
g_main_loop_unref (rdmainloop);
g_main_loop_unref (error_loop);
#ifdef G_OS_WIN32
WSACleanup();
#endif
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment