Update of /cvsroot/freevo/freevo/src/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18658/src/util

Modified Files:
        fthread.py 
Log Message:
handle exceptions in thread

Index: fthread.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/fthread.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** fthread.py  19 Dec 2004 10:47:46 -0000      1.3
--- fthread.py  2 Jan 2005 11:48:36 -0000       1.4
***************
*** 52,66 ****
      def __init__(self, function, *args, **kargs):
          threading.Thread.__init__(self)
!         self.function = function
!         self.args     = args
!         self.kargs    = kargs
!         self.result   = None
!         self.finished = False
! 
      def run(self):
          """
          Call the function and store the result
          """
!         self.result = self.function(*self.args, **self.kargs)
          self.finished = True
  
--- 52,70 ----
      def __init__(self, function, *args, **kargs):
          threading.Thread.__init__(self)
!         self.function  = function
!         self.args      = args
!         self.kargs     = kargs
!         self.result    = None
!         self.finished  = False
!         self.exception = None
!         
      def run(self):
          """
          Call the function and store the result
          """
!         try:
!             self.result = self.function(*self.args, **self.kargs)
!         except Exception, e:
!             self.exception = e
          self.finished = True
  
***************
*** 81,83 ****
--- 85,89 ----
          notifier.step()
      thread.join()
+     if thread.exception:
+         raise thread.exception
      return thread.result



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to