summaryrefslogtreecommitdiff
path: root/src/ivyprobe.c
diff options
context:
space:
mode:
authorfcolin2005-08-18 07:36:18 +0000
committerfcolin2005-08-18 07:36:18 +0000
commit9921017a4b14b379d99305e17f8583ff90de0c1b (patch)
tree2f76b0a528a766ee67be1ba82973f02acc6e85c2 /src/ivyprobe.c
parentf625f6e00c1d5d1194ce3db62e59ccc47fdf2386 (diff)
downloadivy-c-9921017a4b14b379d99305e17f8583ff90de0c1b.zip
ivy-c-9921017a4b14b379d99305e17f8583ff90de0c1b.tar.gz
ivy-c-9921017a4b14b379d99305e17f8583ff90de0c1b.tar.bz2
ivy-c-9921017a4b14b379d99305e17f8583ff90de0c1b.tar.xz
memory leak malloc/free cleanup
Diffstat (limited to 'src/ivyprobe.c')
-rw-r--r--src/ivyprobe.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/ivyprobe.c b/src/ivyprobe.c
index bea1625..dc134a0 100644
--- a/src/ivyprobe.c
+++ b/src/ivyprobe.c
@@ -238,7 +238,11 @@ void HandleStdin (Channel channel, IVY_HANDLE fd, void *data)
fbindcallback=0;
}
} else if (strcmp(cmd, "quit") == 0) {
- exit(0);
+ IvyStop(); /* this wil exit MainLoop */
+ //exit(0);
+#ifdef WIN32
+ ExitThread( 0 ); /* exit STDin handle thread */
+#endif
}
} else {
cmd = strtok (buf, "\n");
@@ -255,7 +259,7 @@ DWORD WINAPI HandleStdinThread( LPVOID lpParam )
while( 1 )
HandleStdin( 0,0,0);
}
-void CraeteStdinThread()
+void CreateStdinThread()
{
DWORD dwThreadId, dwThrdParam = 1;
HANDLE hThread;
@@ -276,6 +280,17 @@ void CraeteStdinThread()
}
}
#endif
+
+void StartHandleStdin()
+{
+#ifdef WIN32
+ /* Stdin not compatible with select , select only accept socket */
+ /* use Thread to Read StdIn */
+ CreateStdinThread();
+#else
+ IvyChannelAdd (0, NULL, NULL, HandleStdin);
+#endif
+}
void ApplicationCallback (IvyClientPtr app, void *user_data, IvyApplicationEvent event)
{
char *appname;
@@ -294,8 +309,7 @@ void ApplicationCallback (IvyClientPtr app, void *user_data, IvyApplicationEvent
printf("%s subscribes to '%s'\n",appname,*msgList++);
/* printf("Application(%s): End Messages\n",appname);*/
if (app_count == wait_count)
-
- IvyChannelAdd (0, NULL, NULL, HandleStdin);
+ StartHandleStdin();
break;
case IvyApplicationDisconnected:
@@ -385,14 +399,7 @@ int main(int argc, char *argv[])
IvyBindMsg (Callback, NULL, argv[optind]);
if (wait_count == 0)
-#ifdef WIN32
- /* Stdin not compatible with select , select only accept socket */
- /* use Thread to Read StdIn */
- CraeteStdinThread();
-#else
- IvyChannelAdd (0, NULL, NULL, HandleStdin);
-#endif
-
+ StartHandleStdin();
IvyStart (bus);
@@ -408,6 +415,9 @@ int main(int argc, char *argv[])
#endif
IvyMainLoop (0);
+ #ifdef _CRTDBG_MAP_ALLOC
+ _CrtDumpMemoryLeaks();
+ #endif
return 0;
}