Author: gonzalo
Date: 2005-04-23 03:41:15 -0400 (Sat, 23 Apr 2005)
New Revision: 43471

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

        * threadpool.c: check for SuspendRequested too when deciding if
        mono_thread_interruption_checkpoint should be called.



Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2005-04-23 07:24:33 UTC (rev 43470)
+++ trunk/mono/mono/metadata/ChangeLog  2005-04-23 07:41:15 UTC (rev 43471)
@@ -1,5 +1,10 @@
 2005-04-23 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
+       * threadpool.c: check for SuspendRequested too when deciding if
+       mono_thread_interruption_checkpoint should be called.
+
+2005-04-23 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
        * appdomain.[ch]: added function to set the shutting_down flag to TRUE.
        * threads.c: remove interruption_mutex and use Interlocked instead. When
        suspending all the threads, wait for all the suspended events at once.

Modified: trunk/mono/mono/metadata/threadpool.c
===================================================================
--- trunk/mono/mono/metadata/threadpool.c       2005-04-23 07:24:33 UTC (rev 
43470)
+++ trunk/mono/mono/metadata/threadpool.c       2005-04-23 07:41:15 UTC (rev 
43471)
@@ -47,6 +47,9 @@
 
 #include "threadpool.h"
 
+#define THREAD_WANTS_A_BREAK(t) ((t->state & (ThreadState_StopRequested | \
+                                               ThreadState_SuspendRequested)) 
!= 0)
+
 #undef EPOLL_DEBUG
 
 /* maximum number of worker threads */
@@ -250,7 +253,7 @@
                        
                        do {
                                wr = WaitForSingleObjectEx (io_job_added, 
(guint32)timeout, TRUE);
-                               if ((thread->state & 
ThreadState_StopRequested)!=0)
+                               if (THREAD_WANTS_A_BREAK (thread))
                                        mono_thread_interruption_checkpoint ();
                        
                                timeout -= GetTickCount () - start_time;
@@ -381,7 +384,7 @@
 
                do {
                        if (nsock == -1) {
-                               if ((thread->state & ThreadState_StopRequested) 
!= 0)
+                               if (THREAD_WANTS_A_BREAK (thread))
                                        mono_thread_interruption_checkpoint ();
                        }
 
@@ -512,12 +515,8 @@
        while (1) {
                do {
                        if (ready == -1) {
-                               if ((thread->state & ThreadState_StopRequested) 
!= 0) {
-                                       g_free (events);
-                                       close (epollfd);
+                               if (THREAD_WANTS_A_BREAK (thread))
                                        mono_thread_interruption_checkpoint ();
-                                       g_assert_not_reached ();
-                               }
                        }
 #ifdef EPOLL_DEBUG
                        g_print ("epoll_wait init\n");
@@ -1094,7 +1093,7 @@
                        
                        do {
                                wr = WaitForSingleObjectEx (job_added, 
(guint32)timeout, TRUE);
-                               if ((thread->state & 
ThreadState_StopRequested)!=0)
+                               if (THREAD_WANTS_A_BREAK (thread))
                                        mono_thread_interruption_checkpoint ();
                        
                                timeout -= GetTickCount () - start_time;
@@ -1111,7 +1110,7 @@
        
                        while (!data && workers <= min) {
                                WaitForSingleObjectEx (job_added, INFINITE, 
TRUE);
-                               if ((thread->state & 
ThreadState_StopRequested)!=0)
+                               if (THREAD_WANTS_A_BREAK (thread))
                                        mono_thread_interruption_checkpoint ();
                        
                                data = dequeue_job (&mono_delegate_section, 
&async_call_queue);

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

Reply via email to