diff src/protocols/gg/lib/events.c @ 11546:3c536224f0d0

[gaim-migrate @ 13801] Update gg to compile and seem to work on win32. The win32 thread implementation in libgg has not been tested *at all*, but I think that the gaim tie-in is all synchronous anyway (yes, it hangs up the UI wonderfully whendoing stuff). I should probably look into getting some of this stuff back into libgg committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 14 Sep 2005 19:10:39 +0000
parents cf15c1cdcfbd
children 9cbc5967fbfd
line wrap: on
line diff
--- a/src/protocols/gg/lib/events.c	Wed Sep 14 19:01:33 2005 +0000
+++ b/src/protocols/gg/lib/events.c	Wed Sep 14 19:10:39 2005 +0000
@@ -1,4 +1,4 @@
-/* $Id: events.c 13582 2005-08-28 22:46:01Z boler $ */
+/* $Id: events.c 13801 2005-09-14 19:10:39Z datallah $ */
 
 /*
  *  (C) Copyright 2001-2003 Wojtek Kaniewski <wojtekka@irc.pl>
@@ -21,11 +21,13 @@
  */
 
 #include <sys/types.h>
+#ifndef _WIN32
 #include <sys/wait.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#endif
 
 #include "libgadu-config.h"
 
@@ -830,15 +832,22 @@
 			close(sess->fd);
 			sess->fd = -1;
 
-#ifndef __GG_LIBGADU_HAVE_PTHREAD
-			waitpid(sess->pid, NULL, 0);
-			sess->pid = -1;
-#else
+#ifdef __GG_LIBGADU_HAVE_PTHREAD
 			if (sess->resolver) {
 				pthread_cancel(*((pthread_t*) sess->resolver));
 				free(sess->resolver);
 				sess->resolver = NULL;
 			}
+#elif defined _WIN32
+			if (sess->resolver) {
+				HANDLE h = sess->resolver;
+				TerminateThread(h, 0);
+				CloseHandle(h);
+				sess->resolver = NULL;
+			}
+#else
+			waitpid(sess->pid, NULL, 0);
+			sess->pid = -1;
 #endif
 
 			if (failed) {