Author: gonzalo
Date: 2005-04-13 13:12:26 -0400 (Wed, 13 Apr 2005)
New Revision: 42931

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/threadpool.c
Log:
2005-04-13 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * threadpool.c: the epollfd might be closed by another thread at
        any time, so ignore EBADF at treat it as a "we're closing" sign.



Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2005-04-13 16:58:27 UTC (rev 42930)
+++ trunk/mono/mono/metadata/ChangeLog  2005-04-13 17:12:26 UTC (rev 42931)
@@ -1,5 +1,10 @@
 2005-04-13 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
+       * threadpool.c: the epollfd might be closed by another thread at
+       any time, so ignore EBADF at treat it as a "we're closing" sign.
+
+2005-04-13 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
        * threadpool.c: release the semaphores with a count equals to the number
        of working threads in both IO and regular pools. Fixed typo that messed
        up the count of IO pool threads. Don't initialize the pipe handles if

Modified: trunk/mono/mono/metadata/threadpool.c
===================================================================
--- trunk/mono/mono/metadata/threadpool.c       2005-04-13 16:58:27 UTC (rev 
42930)
+++ trunk/mono/mono/metadata/threadpool.c       2005-04-13 17:12:26 UTC (rev 
42931)
@@ -514,9 +514,12 @@
 
                if (ready == -1) {
                        int err = errno;
-                       g_warning ("epoll_wait: %d %s\n", err, g_strerror 
(err));
                        g_free (events);
-                       close (epollfd);
+                       if (err != EBADF) {
+                               g_warning ("epoll_wait: %d %s\n", err, 
g_strerror (err));
+                       } else {
+                               close (epollfd);
+                       }
                        return;
                }
 
@@ -556,7 +559,11 @@
 #endif
                                if (epoll_ctl (epollfd, EPOLL_CTL_MOD, fd, 
evt)) {
                                        int err = errno;
-                                       g_message ("epoll_ctl(MOD): %d %s", 
err, g_strerror (err));
+                                       if (err == EBADF) {
+                                               g_free (events);
+                                               return; /* epollfd closed */
+                                       }
+                                       g_message ("epoll_ctl(MOD): %d %s fd: 
%d events: %d", err, g_strerror (err), fd, evt->events);
                                }
                        } else {
                                g_hash_table_remove (data->sock_to_state, 
GINT_TO_POINTER (fd));
@@ -565,6 +572,10 @@
 #endif
                                if (epoll_ctl (epollfd, EPOLL_CTL_DEL, fd, 
evt)) {
                                        int err = errno;
+                                       if (err == EBADF) {
+                                               g_free (events);
+                                               return; /* epollfd closed */
+                                       }
                                        g_message ("epoll_ctl(DEL): %d %s", 
err, g_strerror (err));
                                }
                        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to