dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/support hb_gc.c,1.16,1.17 thread.c,1.8,1


From: Thong Nguyen <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/support hb_gc.c,1.16,1.17 thread.c,1.8,1.9
Date: Sat, 05 Jul 2003 20:41:19 -0400

Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv17627/support

Modified Files:
        hb_gc.c thread.c 
Log Message:
More threading improvements.


Index: hb_gc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/hb_gc.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** hb_gc.c     5 Jul 2003 22:51:32 -0000       1.16
--- hb_gc.c     6 Jul 2003 00:41:16 -0000       1.17
***************
*** 43,46 ****
--- 43,47 ----
  static ILWaitHandle *g_FinalizerSignal = 0;
  static ILWaitHandle *g_FinalizerResponse = 0;
+ static ILMutex *g_GcLock = 0;
  
  #ifdef GC_TRACE_ENABLE
***************
*** 172,175 ****
--- 173,177 ----
        /* Create the finalizer thread */
        g_Deinit = 0;
+       g_GcLock = ILMutexCreate();
        g_FinalizerThread = ILThreadCreate(FinalizerThreadFunc, 0);
        
***************
*** 188,196 ****
        g_Deinit = 1;
  
        ILGCCollect();
  
!       /* Wait up to 10 seconds for the finalizers to run */
!               
        PrivateGCNotifyFinalize(10000);
  }
  
--- 190,211 ----
        g_Deinit = 1;
  
+       /* Do a final GC */
        ILGCCollect();
  
!       /* Wait up to 10 seconds for the finalizers to run */           
        PrivateGCNotifyFinalize(10000);
+ 
+       /* Cleanup the finalizer thread */
+       if (g_FinalizerThread)
+       {
+               /* Unregister and destroy the finalizer thread if it's 
responding */
+               if (ILThreadJoin(g_FinalizerThread, 1000))
+               {
+                       
ILThreadUnregisterForManagedExecution(g_FinalizerThread);
+                       ILThreadDestroy(g_FinalizerThread);                     
+               }               
+       }
+ 
+       ILMutexDestroy(g_GcLock);
  }
  

Index: thread.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/thread.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** thread.c    5 Jul 2003 22:51:32 -0000       1.8
--- thread.c    6 Jul 2003 00:41:16 -0000       1.9
***************
*** 250,254 ****
        {
                thread->state |= IL_TS_STOPPED;
!               _ILThreadTerminate(thread);
                iscounted = 1;
                isbg = ((thread->state & IL_TS_BACKGROUND) != 0);
--- 250,260 ----
        {
                thread->state |= IL_TS_STOPPED;
! 
!               /* Only terminate the system thread if one was created */
!               if ((thread->state & IL_TS_UNSTARTED) == 0)
!               {
!                       _ILThreadTerminate(thread);
!               }
! 
                iscounted = 1;
                isbg = ((thread->state & IL_TS_BACKGROUND) != 0);
***************
*** 257,261 ****
        /* Unlock the thread object and free it */
        _ILMutexUnlock(&(thread->lock));
!       _ILThreadDestroy(thread);
        _ILMutexDestroy(&(thread->lock));
        _ILSemaphoreDestroy(&(thread->suspendAck));
--- 263,272 ----
        /* Unlock the thread object and free it */
        _ILMutexUnlock(&(thread->lock));
! 
!       /* Only destroy the system thread if one was created */
!       if ((thread->state & IL_TS_UNSTARTED) == 0)
!       {
!               _ILThreadDestroy(thread);
!       }
        _ILMutexDestroy(&(thread->lock));
        _ILSemaphoreDestroy(&(thread->suspendAck));





reply via email to

[Prev in Thread] Current Thread [Next in Thread]