Author: tack
Date: Sun Feb 10 21:38:02 2008
New Revision: 3043

Log:
Revert recent changes to is_mainthread().  Fix bug when calling Process.start
from non-mainthread, Watcher.append was not being called.


Modified:
   trunk/base/src/notifier/main.py
   trunk/base/src/notifier/popen.py
   trunk/base/src/notifier/thread.py

Modified: trunk/base/src/notifier/main.py
==============================================================================
--- trunk/base/src/notifier/main.py     (original)
+++ trunk/base/src/notifier/main.py     Sun Feb 10 21:38:02 2008
@@ -87,13 +87,14 @@
     is raised or sys.exit is called.
     """
     global _running
-    _running = True
     unhandled_exception = None
 
-    if is_mainthread() is False:
+    if is_running():
         raise RuntimeError('Mainthread is already running')
 
+    _running = True
     set_as_mainthread()
+
     while True:
         try:
             notifier.step()

Modified: trunk/base/src/notifier/popen.py
==============================================================================
--- trunk/base/src/notifier/popen.py    (original)
+++ trunk/base/src/notifier/popen.py    Sun Feb 10 21:38:02 2008
@@ -175,7 +175,7 @@
 
         # add child to watcher
         if not is_mainthread():
-            MainThreadCallback(proclist.append, self, self.__child_died )
+            MainThreadCallback(proclist.append)(self, self.__child_died)
         else:
             proclist.append( self, self.__child_died )
         self.in_progress = InProgress()

Modified: trunk/base/src/notifier/thread.py
==============================================================================
--- trunk/base/src/notifier/thread.py   (original)
+++ trunk/base/src/notifier/thread.py   Sun Feb 10 21:38:02 2008
@@ -202,20 +202,14 @@
     
 def is_mainthread():
     """
-    Return True if the caller is in the main thread right now, and False if
-    some other thread is the main thread.  If no main thread has been
-    set, returns None.
+    Return True if the caller is in the main thread right now.
     """
     # If threading module is None, assume main thread.  (Silences pointless
     # exceptions on shutdown.)
-    if not threading or threading.currentThread() == 
_thread_notifier_mainthread:
-        return True
-    elif _thread_notifier_mainthread is None:
-        return None
-    return False
+    return (not threading) or threading.currentThread() == 
_thread_notifier_mainthread
 
 
-_thread_notifier_mainthread = None
+_thread_notifier_mainthread = threading.currentThread()
 _thread_notifier_lock = threading.Lock()
 _thread_notifier_queue = []
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to