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

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

[Dotgnu-pnet-commits] CVS: pnet/engine process.c, 1.51, 1.52 thread.c, 1


From: Thong Nguyen <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine process.c, 1.51, 1.52 thread.c, 1.20, 1.21
Date: Wed, 09 Jul 2003 02:58:26 -0400

Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv19633/engine

Modified Files:
        process.c thread.c 
Log Message:
Fix finalizer cleanup bug.


Index: process.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/process.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -r1.51 -r1.52
*** process.c   8 Jul 2003 12:05:17 -0000       1.51
--- process.c   9 Jul 2003 06:58:23 -0000       1.52
***************
*** 20,23 ****
--- 20,24 ----
  
  #include "engine.h"
+ #include "lib_defs.h"
  
  #ifdef        __cplusplus
***************
*** 181,187 ****
                else
                {
!                       /* The thread isn't a finalizer thread so destroy it */
  
                        ILThreadDestroy(thread->supportThread);
                        _ILExecThreadDestroy(thread);
                }
--- 182,202 ----
                else
                {
!                       /* The thread isn't a finalizer thread so destroy it to 
free up its stack space
!                           so the finalizer can reclaim everything 
!                               Note: This is threadsafe.  There's no way the 
finalizer could run on the
!                               CLR thread while we still hold a reference to 
it */
  
+                       if (thread->clrThread)
+                       {
+                               /* Null out the privateData field so the thread 
doesn't try to destroy
+                                   the ILThread twice when it finalizes */
+ 
+                               ((System_Thread 
*)thread->clrThread)->privateData = 0;
+                       }
+ 
+                       /* Destroy the support thread */
                        ILThreadDestroy(thread->supportThread);
+ 
+                       /* Destroy the engine thread */
                        _ILExecThreadDestroy(thread);
                }
***************
*** 194,200 ****
  
        /* Tell the GC we're history */ 
!       /* This performs a final collect and finalizer run */
        ILGCDeinit();
!       
        /* Destroy the CVM coder instance */
        ILCoderDestroy(process->coder);
--- 209,217 ----
  
        /* Tell the GC we're history */ 
!       /* This performs a final collect and finalizer run and also destroy any 
finalizer threads */
        ILGCDeinit();
! 
!       /* All threads should be destroyed now */
! 
        /* Destroy the CVM coder instance */
        ILCoderDestroy(process->coder);

Index: thread.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/thread.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** thread.c    6 Jul 2003 22:02:27 -0000       1.20
--- thread.c    9 Jul 2003 06:58:23 -0000       1.21
***************
*** 137,140 ****
--- 137,141 ----
        thread->freeMonitor = 0;        
        thread->pc = 0;
+       thread->isFinalizerThread = 0;
        thread->frame = thread->stackBase;
        thread->stackTop = thread->stackBase;





reply via email to

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