[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/support hb_gc.c,1.11,1.12
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/support hb_gc.c,1.11,1.12 |
Date: |
Sun, 29 Jun 2003 17:35:07 -0400 |
Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv11839/support
Modified Files:
hb_gc.c
Log Message:
Refactored some code. Finalizers now always halt the current thread.
Index: hb_gc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/hb_gc.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** hb_gc.c 26 Jun 2003 09:22:31 -0000 1.11
--- hb_gc.c 29 Jun 2003 21:35:04 -0000 1.12
***************
*** 40,46 ****
static volatile int g_Deinit = 0;
! static ILThread *g_FinalizerThread;
! static ILWaitHandle *g_FinalizerSignal;
! static ILWaitHandle *g_FinalizerResponse;
#ifdef GC_TRACE_ENABLE
--- 40,46 ----
static volatile int g_Deinit = 0;
! static ILThread *g_FinalizerThread = 0;
! static ILWaitHandle *g_FinalizerSignal = 0;
! static ILWaitHandle *g_FinalizerResponse = 0;
#ifdef GC_TRACE_ENABLE
***************
*** 98,137 ****
ILExecThread *thread;
if (!ILHasThreads())
{
GC_invoke_finalizers();
! return 0;
}
! if(!FinalizersDisabled)
! {
! /* Register the finalizer thread for managed code execution */
! ILThreadAtomicStart();
! if (ILThreadGetObject(g_FinalizerThread) == 0)
! {
! /* Make sure the the finalizer thread is registered for
managed execution. */
! /* This can't be done in ILGCInit cause the runtime
isn't fully initialized in that function */
! thread = (ILExecThread
*)ILThreadGetObject(ILThreadSelf());
!
ILThreadRegisterForManagedExecution(ILExecThreadGetProcess(thread),
g_FinalizerThread, 0);
! }
! ILThreadAtomicEnd();
! /* Signal the finalizer thread */
! ILWaitEventSet(g_FinalizerSignal);
! return 1;
! }
! else
! {
! return 0;
! }
}
--- 98,140 ----
ILExecThread *thread;
+ if (FinalizersDisabled || g_FinalizerThread == 0)
+ {
+ return 0;
+ }
+
if (!ILHasThreads())
{
GC_invoke_finalizers();
! return 1;
}
! /* Register the finalizer thread for managed code execution */
! ILThreadAtomicStart();
! if (ILThreadGetObject(g_FinalizerThread) == 0)
! {
! /* Make sure the the finalizer thread is registered for managed
execution. */
! /* This can't be done in ILGCInit cause the runtime isn't fully
initialized in that function */
! thread = (ILExecThread *)ILThreadGetObject(ILThreadSelf());
!
ILThreadRegisterForManagedExecution(ILExecThreadGetProcess(thread),
g_FinalizerThread, 0);
! }
! ILThreadAtomicEnd();
! /* Signal the finalizer thread */
! ILWaitEventSet(g_FinalizerSignal);
! GC_TRACE("ILGCInvokeFinalizers: Invoked finalizers and waiting [thread:
%d]\n", (int)ILThreadSelf());
!
! /* Wait until finalizers have finished */
! ILWaitOne(g_FinalizerResponse, -1);
! GC_TRACE("ILGCInvokeFinalizers: Finalizers finished[thread: %d]\n",
(int)ILThreadSelf());
! return 1;
}
***************
*** 230,253 ****
void ILGCInvokeFinalizers(void)
{
! if (!ILHasThreads())
! {
! PrivateGCNotifyFinalize();
!
! return;
! }
!
! if(!FinalizersDisabled)
! {
! /* Signal the finalizers to run (returns 1 if successful) */
! if (PrivateGCNotifyFinalize())
! {
! GC_TRACE("ILGCInvokeFinalizers: Invoked finalizers and
waiting [thread: %d]\n", (int)ILThreadSelf());
!
! /* Wait until finalizers have finished */
! ILWaitOne(g_FinalizerResponse, -1);
!
! GC_TRACE("ILGCInvokeFinalizers: Finalizers
finished[thread: %d]\n", (int)ILThreadSelf());
! }
! }
}
--- 233,237 ----
void ILGCInvokeFinalizers(void)
{
! PrivateGCNotifyFinalize();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/support hb_gc.c,1.11,1.12,
Rhys Weatherley <address@hidden> <=