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

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

[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and to


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. 075f7154810b47e12c54f2524b722e8d9e65365a
Date: Thu, 29 Oct 2009 12:05:23 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "DotGNU Portable.NET engine, compilers and tools (pnet)".

The branch, master has been updated
       via  075f7154810b47e12c54f2524b722e8d9e65365a (commit)
      from  a80673021cfbf67c4ea609b7f17441e8ac80c565 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/pnet.git/commit/?id=075f7154810b47e12c54f2524b722e8d9e65365a

commit 075f7154810b47e12c54f2524b722e8d9e65365a
Author: Klaus Treichel <address@hidden>
Date:   Thu Oct 29 13:04:58 2009 +0100

    Add two threading macros that should be used internally instead of the
    public functions and replace the public function calls with those macros.

diff --git a/ChangeLog b/ChangeLog
index c9a6774..7b8a680 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2009-10-29  Klaus Treichel  <address@hidden>
 
+       * support/pt_defs.c: Initialize the thread local variable _myThread
+       with 0.
+
+       * support/thr_defs.h: Add macros for internal use _ILHasThreads and
+       _ILThreadSelf that should be used internally instead of the public
+       functions with the same name without leading underscore.
+
+       * support/hb_gc.c, support/thread.c: Replace calls to the public
+       functions with the internal macros where appropriate.
+
        * tests/ilunit.h: Add prototype for test cleanup function
        ILUnitCleanupTests.
 
diff --git a/support/hb_gc.c b/support/hb_gc.c
index 6836e61..a5addb2 100644
--- a/support/hb_gc.c
+++ b/support/hb_gc.c
@@ -115,13 +115,13 @@ extern GC_signed_word GC_bytes_found;
  */
 static void _FinalizerThreadFunc(void *data)
 {
-       GC_TRACE("GC:_FinalizerThread: Finalizer thread started [thread:%p]\n", 
ILThreadSelf());
+       GC_TRACE("GC:_FinalizerThread: Finalizer thread started [thread:%p]\n", 
_ILThreadSelf());
 
        for (;;)
        {
                ILWaitOne(_FinalizerSignal, -1);
 
-               GC_TRACE("GC:_FinalizerThread: Signal [thread:%p]\n", 
ILThreadSelf());
+               GC_TRACE("GC:_FinalizerThread: Signal [thread:%p]\n", 
_ILThreadSelf());
 
                /* This *must* to be set before checking for 
!_FinalizersDisabled to prevent
                    a race with ILGCDisableFinalizers */
@@ -132,13 +132,13 @@ static void _FinalizerThreadFunc(void *data)
 
                if (GC_should_invoke_finalizers() && !_FinalizersDisabled)
                {
-                       GC_TRACE("GC:_FinalizerThread: Finalizers running 
[thread:%p]\n", ILThreadSelf());
+                       GC_TRACE("GC:_FinalizerThread: Finalizers running 
[thread:%p]\n", _ILThreadSelf());
                        
                        ++_FinalizingCount;
 
                        GC_invoke_finalizers();
                        
-                       GC_TRACE("GC:_FinalizerThread: Finalizers finished 
[thread:%p]\n", ILThreadSelf());
+                       GC_TRACE("GC:_FinalizerThread: Finalizers finished 
[thread:%p]\n", _ILThreadSelf());
                }
 
                _FinalizersRunning = 0;
@@ -149,7 +149,7 @@ static void _FinalizerThreadFunc(void *data)
                {
                        /* Exit finalizer thread after having invoked 
finalizers one last time */
 
-                       GC_TRACE("GC:_FinalizerThread: Finalizer thread 
finished [thread:%p]\n", ILThreadSelf());
+                       GC_TRACE("GC:_FinalizerThread: Finalizer thread 
finished [thread:%p]\n", _ILThreadSelf());
 
                        ILWaitEventReset(_FinalizerSignal);
                        /* Wake all waiting threads */
@@ -158,7 +158,7 @@ static void _FinalizerThreadFunc(void *data)
                        return;
                }
 
-               GC_TRACE("GC:_FinalizerThread: Response [thread:%p]\n", 
ILThreadSelf());
+               GC_TRACE("GC:_FinalizerThread: Response [thread:%p]\n", 
_ILThreadSelf());
 
                ILThreadClearStack(4000);
 
@@ -229,7 +229,7 @@ static int PrivateGCNotifyFinalize(int timeout, int 
ignoreDisabled)
        }
 
        /* Prevent recursive finalization */
-       if (_FinalizersRunningSynchronously || ILThreadSelf() == 
_FinalizerThread)
+       if (_FinalizersRunningSynchronously || _ILThreadSelf() == 
_FinalizerThread)
        {       
                return 0;
        }
@@ -265,7 +265,7 @@ static int PrivateGCNotifyFinalize(int timeout, int 
ignoreDisabled)
 
                                GC_TRACE("PrivateGCInvokeFinalizers: Couldn't " 
\
                                                 "start finalizer thread 
[thread: %p]\n",
-                                                ILThreadSelf());
+                                                _ILThreadSelf());
                                
                                _ILMutexUnlock(&_FinalizerLock);
 
@@ -281,11 +281,11 @@ static int PrivateGCNotifyFinalize(int timeout, int 
ignoreDisabled)
        /* Signal the finalizer thread */
 
        GC_TRACE("PrivateGCInvokeFinalizers: Invoking finalizers " \
-                       "and waiting [thread: %p]\n", ILThreadSelf());
+                       "and waiting [thread: %p]\n", _ILThreadSelf());
 
        result = ILSignalAndWait(_FinalizerSignal, _FinalizerResponse, timeout);
        
-       GC_TRACE("PrivateGCInvokeFinalizers: Finalizers finished[thread: 
%p]\n", ILThreadSelf());
+       GC_TRACE("PrivateGCInvokeFinalizers: Finalizers finished[thread: 
%p]\n", _ILThreadSelf());
 
        return result;
 }
@@ -339,7 +339,7 @@ void ILGCDeinit()
 {
        _FinalizerStopFlag = 1;
 
-       GC_TRACE("ILGCDeinit: Performing final GC [thread:%p]\n", 
ILThreadSelf());
+       GC_TRACE("ILGCDeinit: Performing final GC [thread:%p]\n", 
_ILThreadSelf());
 
        /* Do a final GC */
        ILGCFullCollection(1000);
@@ -347,20 +347,20 @@ void ILGCDeinit()
        /* Cleanup the finalizer thread */
        if (_FinalizerThread && _FinalizerThreadStarted)
        {
-               GC_TRACE("ILGCDeinit: Peforming last finalizer run 
[thread:%p]\n", ILThreadSelf());
+               GC_TRACE("ILGCDeinit: Peforming last finalizer run 
[thread:%p]\n", _ILThreadSelf());
 
                ILWaitEventSet(_FinalizerSignal);
                
-               GC_TRACE("ILGCDeinit: Waiting for finalizer thread to end 
[thread:%p]\n", ILThreadSelf());
+               GC_TRACE("ILGCDeinit: Waiting for finalizer thread to end 
[thread:%p]\n", _ILThreadSelf());
 
                /* Wait for the finalizer thread */
                if (ILThreadJoin(_FinalizerThread, 15000))
                {
-                       GC_TRACE("ILGCDeinit: Finalizer thread finished 
[thread:%p]\n", ILThreadSelf());                        
+                       GC_TRACE("ILGCDeinit: Finalizer thread finished 
[thread:%p]\n", _ILThreadSelf());
                }
                else
                {
-                       GC_TRACE("ILGCDeinit: Finalizer thread not responding 
[thread:%p]\n", ILThreadSelf());
+                       GC_TRACE("ILGCDeinit: Finalizer thread not responding 
[thread:%p]\n", _ILThreadSelf());
                }
 
                /* Destroy the finalizer thread */
@@ -433,7 +433,7 @@ int ILGCFullCollection(int timeout)
        int lastFinalizingCount;
        int hasThreads;
 
-       hasThreads = ILHasThreads();
+       hasThreads = _ILHasThreads();
 
        if (timeout < 0)
        {
@@ -577,7 +577,7 @@ int ILGCDisableFinalizers(int timeout)
 
        _ILMutexUnlock(&_FinalizerLock);
 
-       if (_FinalizersRunning && ILHasThreads())
+       if (_FinalizersRunning && _ILHasThreads())
        {
                /* Invoke and wait so we can guarantee no finalizers will run 
after this method ends */
                return (PrivateGCNotifyFinalize(timeout, 1) ? 0 : 1);
diff --git a/support/pt_defs.c b/support/pt_defs.c
index 22d1db8..132be44 100755
--- a/support/pt_defs.c
+++ b/support/pt_defs.c
@@ -46,7 +46,7 @@ extern        "C" {
  * Define the thread local variable to hold the ILThread value for the
  * current thread.
  */
-_THREAD_ ILThread *_myThread;
+_THREAD_ ILThread *_myThread = 0;
 #else
 /*
  * Thread-specific key that is used to store and retrieve thread objects.
diff --git a/support/thr_defs.h b/support/thr_defs.h
index e511cad..5ff5685 100755
--- a/support/thr_defs.h
+++ b/support/thr_defs.h
@@ -417,6 +417,13 @@ struct _tagILMonitorPool
                        } while (0)
 
 /*
+ * Some macros that can be used internally as shortcut instead of using
+ * the public interface functions (named without the leading underscore)
+ */
+#define _ILHasThreads()        _ILThreadIsReal
+#define _ILThreadSelf()        _ILThreadGetSelf()
+
+/*
  * Initialize the system-specific thread routines and find the
  * thread handle and identifier for the main thread.
  */
diff --git a/support/thread.c b/support/thread.c
index a72cc1f..70a3c12 100644
--- a/support/thread.c
+++ b/support/thread.c
@@ -66,7 +66,7 @@ static ILThread mainThread;
 
 int ILHasThreads(void)
 {
-       return _ILThreadIsReal;
+       return _ILHasThreads();
 }
 
 /*
@@ -367,7 +367,7 @@ ILThread *ILThreadCreate(ILThreadStartFunc startFunc, void 
*startArg)
        ILThread *thread;
 
        /* We cannot create threads if the system doesn't really support them */
-       if(!ILHasThreads())
+       if(!_ILHasThreads())
        {
                return 0;
        }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |   10 ++++++++++
 support/hb_gc.c    |   34 +++++++++++++++++-----------------
 support/pt_defs.c  |    2 +-
 support/thr_defs.h |    7 +++++++
 support/thread.c   |    4 ++--
 5 files changed, 37 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
DotGNU Portable.NET engine, compilers and tools (pnet)




reply via email to

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