Author: gonzalo
Date: 2005-04-12 15:44:05 -0400 (Tue, 12 Apr 2005)
New Revision: 42865
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/threadpool.c
Log:
2005-04-12 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* threadpool.c: windows needs 'closesocket' and instead of returning
0 when the stream is closed while in select, it returns -1. Fixes bug
#74573.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2005-04-12 19:18:08 UTC (rev 42864)
+++ trunk/mono/mono/metadata/ChangeLog 2005-04-12 19:44:05 UTC (rev 42865)
@@ -1,3 +1,9 @@
+2005-04-12 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+ * threadpool.c: windows needs 'closesocket' and instead of returning
+ 0 when the stream is closed while in select, it returns -1. Fixes bug
+ #74573.
+
2005-04-12 Zoltan Varga <[EMAIL PROTECTED]>
* class.c (class_compute_field_layout): Fix the regression caused by
Modified: trunk/mono/mono/metadata/threadpool.c
===================================================================
--- trunk/mono/mono/metadata/threadpool.c 2005-04-12 19:18:08 UTC (rev
42864)
+++ trunk/mono/mono/metadata/threadpool.c 2005-04-12 19:44:05 UTC (rev
42865)
@@ -124,9 +124,14 @@
EnterCriticalSection (&data->io_lock);
data->inited = 0;
+#ifdef PLATFORM_WIN32
+ closesocket (data->pipe [0]);
+ closesocket (data->pipe [1]);
+#else
close (data->pipe [0]);
+ close (data->pipe [1]);
+#endif
data->pipe [0] = -1;
- close (data->pipe [1]);
data->pipe [1] = -1;
CloseHandle (data->new_sem);
data->new_sem = NULL;
@@ -373,6 +378,8 @@
/* Got a new socket */
if ((pfds->revents & MONO_POLLIN) != 0) {
+ int nread;
+
for (i = 1; i < allocated; i++) {
pfd = &pfds [i];
if (pfd->fd == -1 || pfd->fd ==
data->newpfd->fd)
@@ -391,10 +398,15 @@
INIT_POLLFD (&pfds [i], -1, 0);
}
#ifndef PLATFORM_WIN32
- read (data->pipe [0], one, 1);
+ nread = read (data->pipe [0], one, 1);
#else
- recv ((SOCKET) data->pipe [0], one, 1, 0);
+ nread = recv ((SOCKET) data->pipe [0], one, 1, 0);
#endif
+ if (nread <= 0) {
+ g_free (pfds);
+ return; /* we're closed */
+ }
+
INIT_POLLFD (&pfds [i], data->newpfd->fd,
data->newpfd->events);
ReleaseSemaphore (data->new_sem, 1, NULL);
if (i >= maxfd)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches