[IronPython] threading.thread sometimes forced termination!

KATO Kanryu k.kanryu at gmail.com
Mon Feb 8 10:25:13 CET 2010


I tryed to call mythread.start() again after the terminating.


-----------sample code---------------
...
       self.terminated = False
       try:
           # some codes...
           pass
       except: # not called this point :(
           print "catched something!"
       finally:
           self.terminated = True
           print "end MyThread"
...

# in Main Thread
if mythread.terminated:
    print "join!"
    mythread.join()
    print "restart!"
    mythread.start()
----------console------------------
...
join!
restart!
IronPython.Runtime.Exceptions.RuntimeException: thread already started
   場所 DLRCachedCode.start$222(Closure , PythonFunction $function, Object self)
   場所 IronPython.Runtime.PythonFunction.FunctionCaller`1.Call1(CallSite
site, CodeContext context, Object func, T0 arg0)
   場所 CallSite.Target(Closure , CallSite , CodeContext , Object )
   場所 System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite
site, T0 arg0, T1 arg1)
   場所 DLRCachedCode.update$375(Closure , PythonFunction $function, Object self)
   場所 IronPython.Runtime.PythonFunction.FunctionCaller`1.Call1(CallSite
site, CodeContext context, Object func, T0 arg0)
   場所 CallSite.Target(Closure , CallSite , CodeContext , Object )
   場所 DLRCachedCode.update$11(Closure , PythonFunction $function, Object self)
   場所 IronPython.Runtime.PythonFunction.FunctionCaller`1.Call1(CallSite
site, CodeContext context, Object func, T0 arg0)
   場所 CallSite.Target(Closure , CallSite , CodeContext , Object )
   場所 DLRCachedCode.on_update$3(Closure , PythonFunction $function,
Object sender, Object e)
   場所 CallSite.Target(Closure , CallSite , Object , Object , CancelEventArgs )
   場所 _Scripting_(Object[] , Object , CancelEventArgs )


KATO Kanryu



More information about the Ironpython-users mailing list