Author: dmeyer
Date: Sat Sep  1 16:22:29 2007
New Revision: 2793

Log:
make it possible to use execute_in_thread without thread name

Modified:
   trunk/base/src/notifier/jobserver.py

Modified: trunk/base/src/notifier/jobserver.py
==============================================================================
--- trunk/base/src/notifier/jobserver.py        (original)
+++ trunk/base/src/notifier/jobserver.py        Sat Sep  1 16:22:29 2007
@@ -50,7 +50,7 @@
 log = logging.getLogger('notifier.thread')
 
 
-def execute_in_thread(name, priority=0):
+def execute_in_thread(name=None, priority=0):
     """
     The decorator makes sure the function is always called in the thread
     with the given name. The function will return an InProgress object.
@@ -58,9 +58,13 @@
     def decorator(func):
 
         def newfunc(*args, **kwargs):
-            t = ThreadCallback(func, *args, **kwargs)
-            t.register(name, priority)
-            return t
+            if name:
+                t = ThreadCallback(func, *args, **kwargs)
+                t.register(name, priority)
+                return t
+            t = thread.Thread(func, *args, **kwargs)
+            t.wait_on_exit(False)
+            return t.start()
 
         try:
             newfunc.func_name = func.func_name

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to