Author: gonzalo
Date: 2005-04-13 12:47:14 -0400 (Wed, 13 Apr 2005)
New Revision: 42928

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/threadpool.c
Log:
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
        we're using epoll.



Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2005-04-13 16:45:34 UTC (rev 42927)
+++ trunk/mono/mono/metadata/ChangeLog  2005-04-13 16:47:14 UTC (rev 42928)
@@ -1,5 +1,12 @@
 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
+       we're using epoll.
+
+2005-04-13 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
        * threadpool.c: some systems don't like a NULL when deleting the socket
        from epoll.
 

Modified: trunk/mono/mono/metadata/threadpool.c
===================================================================
--- trunk/mono/mono/metadata/threadpool.c       2005-04-13 16:45:34 UTC (rev 
42927)
+++ trunk/mono/mono/metadata/threadpool.c       2005-04-13 16:47:14 UTC (rev 
42928)
@@ -127,6 +127,8 @@
 static void
 socket_io_cleanup (SocketIOData *data)
 {
+       gint release;
+
        if (data->inited == 0)
                return;
 
@@ -148,6 +150,9 @@
        data->sock_to_state = NULL;
        g_list_free (async_io_queue);
        async_io_queue = NULL;
+       release = (gint) InterlockedCompareExchange (&io_worker_threads, 0, -1);
+       if (io_job_added)
+               ReleaseSemaphore (io_job_added, release, NULL);
        g_free (data->newpfd);
        data->newpfd = NULL;
 #ifdef HAVE_EPOLL
@@ -232,9 +237,6 @@
                        
                                if (wr != WAIT_TIMEOUT)
                                        data = dequeue_job (&io_queue_lock, 
&async_io_queue);
-                               
-                               if (timeout <= 0 && data == NULL)
-                                       timeout = 10000;
                        }
                        while (!data && timeout > 0);
                }
@@ -266,8 +268,8 @@
        worker = (int) InterlockedCompareExchange (&io_worker_threads, 0, -1); 
        if (worker <= ++busy &&
            worker < mono_io_max_worker_threads) {
+               InterlockedIncrement (&busy_io_worker_threads);
                InterlockedIncrement (&io_worker_threads);
-               InterlockedIncrement (&io_worker_threads);
                domain = ((ares) ? ((MonoObject *) ares)->vtable->domain : 
mono_domain_get ());
                mono_thread_create (domain, async_invoke_io_thread, ares);
        } else {
@@ -626,10 +628,13 @@
 #endif
 
 #ifndef PLATFORM_WIN32
-       if (pipe (data->pipe) != 0) {
+       if (data->epoll_disabled && pipe (data->pipe) != 0) {
                int err = errno;
                perror ("mono");
                g_assert (err);
+       } else {
+               data->pipe [0] = -1;
+               data->pipe [1] = -1;
        }
 #else
        srv = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
@@ -970,7 +975,7 @@
        EnterCriticalSection (&mono_delegate_section);
        g_list_free (async_call_queue);
        async_call_queue = NULL;
-       release = (gint) InterlockedCompareExchange (&busy_worker_threads, 0, 
-1);
+       release = (gint) InterlockedCompareExchange (&mono_worker_threads, 0, 
-1);
        LeaveCriticalSection (&mono_delegate_section);
        if (job_added)
                ReleaseSemaphore (job_added, release, NULL);

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

Reply via email to