def __call__( self, *args, **kwds ):
self.debugLogThreading( 'ThreadSwitchScheduler(%d:%s): start %r( %r, %r )' % (self.instance_id, self.reason, self.function, args, kwds) )
#pylint disable=bare-except
try:
# call the function
result = self.function( *args, **kwds )
# did the function run or make a generator?
if type(result) != types.GeneratorType:
self.debugLogThreading( 'ThreadSwitchScheduler(%d:%s): done (not GeneratorType)' % (self.instance_id, self.reason) )
# it ran - we are all done
return
# step the generator
self.queueNextSwitch( result )
except:
self.app.log.exception( 'ThreadSwitchScheduler(%d:%s)' % (self.instance_id, self.reason) )
评论列表
文章目录