Beispiel #1
0
 def run(self):
     miniThreadManager.add(self)
     try:
         try:
             self.threadstate = threadstate.ThreadState()
             #                 debug.fmsg("assigning excepthook, function=", self.function)
             hook = excepthook.assign_excepthook(excepthook.OOFexceptHook())
             self.function(*self.args, **self.kwargs)
             excepthook.remove_excepthook(hook)
         except StopThread:
             excepthook.remove_excepthook(hook)
             return
         # TODO SWIG1.3: After conversion to SWIG 1.3, OOF
         # exceptions will probably be subclasses of Exception.
         except (Exception, ooferror.ErrErrorPtr), exception:
             from ooflib.common.IO import reporter
             reporter.error(exception)
             sys.excepthook(*sys.exc_info())
     finally:
         miniThreadManager.remove(self)
         self.threadstate = None
Beispiel #2
0
 def run(self):
     miniThreadManager.add(self)
     try:
         try:
             self.threadstate = threadstate.OOFThreadState()
             hook = excepthook.assign_excepthook(excepthook.OOFexceptHook())
             # debug.fmsg("Starting thread %s: %s" %
             #            (self.id(), self.function))
             self.function(*self.args, **self.kwargs)
             # debug.fmsg("Finished thread", self.id())
             excepthook.remove_excepthook(hook)
         except StopThread:
             excepthook.remove_excepthook(hook)
             return
         # TODO 3.1: After conversion to SWIG 2.x, if that ever
         # happens, OOF exceptions will probably be subclasses of
         # Exception.
         except (Exception, ooferror.ErrErrorPtr), exception:
             from ooflib.common.IO import reporter
             reporter.error(exception)
             sys.excepthook(*sys.exc_info())
     finally:
         miniThreadManager.remove(self)
         self.threadstate = None
Beispiel #3
0
 def initialize(self):  # called on subthread
     #         debug.fmsg("assigning excepthook, menuitem=", self.menuitem.path())
     self.excepthook = excepthook.assign_excepthook(
         excepthook.OOFexceptHook())