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. 008e75c7ebc71eb4f36aa21d94b243d4fc52bdc3
Date: Sat, 12 Sep 2009 11:18:33 +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  008e75c7ebc71eb4f36aa21d94b243d4fc52bdc3 (commit)
      from  4beb58058c82711670fffae441c699ca507d59e2 (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=008e75c7ebc71eb4f36aa21d94b243d4fc52bdc3

commit 008e75c7ebc71eb4f36aa21d94b243d4fc52bdc3
Author: Klaus Treichel <address@hidden>
Date:   Sat Sep 12 13:17:56 2009 +0200

    Fix a bug in lib_gc where a second thread could possibly see an
    uninitialized gcHandle table.

diff --git a/ChangeLog b/ChangeLog
index a52544e..579649b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-12  Klaus Treichel  <address@hidden>
+
+       * engine/lib_gc.c (GetGCHandleTable): Fix a bug where a thread could
+       possibly see an uninitialized gcHandles table.
+
 2009-09-11  Klaus Treichel  <address@hidden>
 
        * engine/cvm_call.c (CHECK_MANAGED_BARRIER): Clear the thread's flags
diff --git a/engine/lib_gc.c b/engine/lib_gc.c
index f1fe22f..72d2a87 100644
--- a/engine/lib_gc.c
+++ b/engine/lib_gc.c
@@ -150,30 +150,28 @@ static ILGCHandleTable *GetGCHandleTable(ILExecThread 
*_thread)
                /* Check again because of race conditions. */
                if(!(process->gcHandles))
                {
+                       ILGCHandleTable *gcHandles;
+
                        /* Disable finalizers here because we hold the process 
lock.
                         * Otherwise we might get a deadlock if finalizers are 
invoked
                         * the first time and the finalizer thread is created.
                         */
                        ILGCDisableFinalizers(-1);
-                       process->gcHandles = (ILGCHandleTable *)
+                       gcHandles = (ILGCHandleTable *)
                                ILGCAllocPersistent(sizeof(ILGCHandleTable));
                        ILGCEnableFinalizers();
-                       if(process->gcHandles)
+                       if(!gcHandles)
                        {
-                               _ILGCHandleTableInit(process->gcHandles);
-                               ILMutexLock(process->gcHandles->lock);
+                               /* The table could not be allocated so bail out 
*/
+                               ILMutexUnlock(process->lock);
+                               return 0;
                        }
-               }
-               else
-               {
-                       ILMutexLock(process->gcHandles->lock);
+                       _ILGCHandleTableInit(gcHandles);
+                       process->gcHandles = gcHandles;
                }
                ILMutexUnlock(process->lock);
        }
-       else
-       {
-               ILMutexLock(process->gcHandles->lock);
-       }
+       ILMutexLock(process->gcHandles->lock);
        return process->gcHandles;
 }
 

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

Summary of changes:
 ChangeLog       |    5 +++++
 engine/lib_gc.c |   22 ++++++++++------------
 2 files changed, 15 insertions(+), 12 deletions(-)


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




reply via email to

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