mailr14748 - /1.3/gui/interpreter.py


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

Header


Content

Posted by edward on September 23, 2011 - 17:46:
Author: bugman
Date: Fri Sep 23 17:46:08 2011
New Revision: 14748

URL: http://svn.gna.org/viewcvs/relax?rev=14748&view=rev
Log:
Bug fix for the GUI interpreter thread flushing on MS Windows.

The Queue.empty() method is documented as being unreliable - and that is 
indeed the case on MS
Windows (not on GNU/Linux or Mac OS X though).  It sometimes returns false, 
continually, when the
queue is completely empty!!!

Now the queue user function __repr__ strings are stored in a list to keep 
track of the queue status.


Modified:
    1.3/gui/interpreter.py

Modified: 1.3/gui/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/interpreter.py?rev=14748&r1=14747&r2=14748&view=diff
==============================================================================
--- 1.3/gui/interpreter.py (original)
+++ 1.3/gui/interpreter.py Fri Sep 23 17:46:08 2011
@@ -207,6 +207,9 @@
         # Create a queue object for the user function calls.
         self._queue = Queue()
 
+        # The list of user functions still in the queue.
+        self._uf_list = []
+
         # A flag for exiting the thread.
         self._exit = False
 
@@ -235,7 +238,7 @@
         sleep(0.5)
 
         # Loop until empty.
-        while not self.empty():
+        while len(self._uf_list):
             # Wait a bit for the queue to empty.
             sleep(0.2)
 
@@ -262,6 +265,9 @@
         @type kwds:     any keyword arguments
         """
 
+        # Add the user function name to the list.
+        self._uf_list.append(repr(fn))
+
         # Place the user function and its args onto the queue.
         self._queue.put([fn, args, kwds])
 
@@ -303,5 +309,8 @@
                 # Release the execution lock.
                 status.exec_lock.release()
 
+                # Remove the user function from the list.
+                self._uf_list.pop(self._uf_list.index(repr(fn)))
+
             # Notify all observers that a user function has completed.
             status.observers.gui_uf.notify()




Related Messages


Powered by MHonArc, Updated Mon Sep 26 12:20:02 2011