[omniORB] Minor patch to src/lib/omniORB/orbcore/rmutex.cc

Alex Tingle alex.omniorb at firetree.net
Fri May 27 15:47:20 BST 2005


I was poking around in the rmutex code, when I noticed what looks like 
a bug. So here's a patch for it.

IMPORTANT: I have not actually observed real life problems caused by 
this bug.

The problem concerns the setting of pd_dummy. When set, this indicates 
that the rmutex should release a dummy omni_thread when it is unlocked. 
However, the pd_dummy member is set BEFORE the lock is acquired, so it 
may cause the wrong omni_thread to be released.

My patch (to branch omni4_0_develop) simply defers setting pd_dummy 
until the lock has been acquired.

-Alex

-- 
:: alex tingle
:: http://www.firetree.net/consulting/
:: alex.tingle AT firetree.net  +44-7901-552763 
-------------- next part --------------
Index: src/lib/omniORB/orbcore/rmutex.cc
===================================================================
RCS file: /cvsroot/omniorb/omni/src/lib/omniORB/orbcore/Attic/rmutex.cc,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 rmutex.cc
--- src/lib/omniORB/orbcore/rmutex.cc	13 Sep 2004 13:20:14 -0000	1.1.2.2
+++ src/lib/omniORB/orbcore/rmutex.cc	17 May 2005 12:53:46 -0000
@@ -49,12 +49,13 @@
 omni_rmutex::lock()
 {
   omni_thread* me = omni_thread::self();
+  int dummy = 0;
 
   if (!me) {
     // Create a dummy thread
     omniORB::logs(15, "Create dummy omni_thread in rmutex lock.");
     me = omni_thread::create_dummy();
-    pd_dummy = 1;
+    dummy = 1;
   }
 
   omni_mutex_lock sync(pd_lock);
@@ -68,6 +69,7 @@
 
   OMNIORB_ASSERT(pd_depth == 0);
   pd_holder = me;
+  pd_dummy  = dummy;
   pd_depth  = 1;
 }
 


More information about the omniORB-list mailing list