mailr14195 - /branches/gui_testing/status.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on August 06, 2011 - 14:00:
Author: bugman
Date: Sat Aug  6 14:00:18 2011
New Revision: 14195

URL: http://svn.gna.org/viewcvs/relax?rev=14195&view=rev
Log:
The execution lock is properly locked or released before notifying the 
observers.

This will remove some race conditions where the locked() method is called 
before the acquire() or
release() methods terminate.


Modified:
    branches/gui_testing/status.py

Modified: branches/gui_testing/status.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/status.py?rev=14195&r1=14194&r2=14195&view=diff
==============================================================================
--- branches/gui_testing/status.py (original)
+++ branches/gui_testing/status.py Sat Aug  6 14:00:18 2011
@@ -212,10 +212,6 @@
         @keyword mode:  The mode of the code trying to obtain the lock.  
This can be one of 'script' for the scripting interface or 'auto-analysis' 
for the auto-analyses.
         @type mode:     str
         """
-
-        # Notify observers.
-        status = Status()
-        status.observers.exec_lock.notify()
 
         # Do not acquire if lunching a script from a script.
         if mode == 'script' and self._mode == 'script' and self.locked():
@@ -254,7 +250,14 @@
             return
 
         # Acquire the real lock.
-        return self._lock.acquire()
+        lock = self._lock.acquire()
+
+        # Notify observers.
+        status = Status()
+        status.observers.exec_lock.notify()
+
+        # Return the real lock.
+        return lock
 
 
     def locked(self):
@@ -274,10 +277,6 @@
     def release(self):
         """Simulate the Lock.release() mechanism."""
 
-        # Notify observers.
-        status = Status()
-        status.observers.exec_lock.notify()
-
         # Nested scripting.
         if self._script_nest:
             # Debugging.
@@ -323,8 +322,14 @@
             return
 
         # Release the real lock.
-        return self._lock.release()
-
+        release = self._lock.release()
+
+        # Notify observers.
+        status = Status()
+        status.observers.exec_lock.notify()
+
+        # Return the status.
+        return release
 
 
 class Observer(object):




Related Messages


Powered by MHonArc, Updated Sat Aug 06 14:20:02 2011