summaryrefslogtreecommitdiff
path: root/src/ivyloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ivyloop.c')
-rw-r--r--src/ivyloop.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ivyloop.c b/src/ivyloop.c
index 278e098..ab50f75 100644
--- a/src/ivyloop.c
+++ b/src/ivyloop.c
@@ -15,16 +15,17 @@
* copyright notice regarding this software
*/
-#ifdef WIN32
-#include <windows.h>
-#endif
+
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#ifndef WIN32
+#ifdef WIN32
+#include <crtdbg.h>
+#include <windows.h>
+#else
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -160,6 +161,7 @@ void IvyChannelInit (void)
void IvyChannelStop (void)
{
MainLoop = 0;
+ ChannelDefferedDelete(); /* this will force select to exit on multithread */
}
void IvyMainLoop(void(*hook)(void))
@@ -181,12 +183,12 @@ void IvyMainLoop(void(*hook)(void))
return;
}
TimerScan();
- if (ready > 0) {
+ if ( MainLoop && ready > 0) {
IvyChannelHandleExcpt(&exset);
IvyChannelHandleRead(&rdset);
continue;
}
- }
+ }
}
void IvyIdle()