![]() Seen.append(greenlet.getcurrent().parent.switch()) Spaceconfig = dict(usemodules=, continuation=True) Source: test_greenlet.py class AppTestGreenlet : Raise exc, value, tb except GreenletExit, e : permute ( greenlet, greenlet.parent )ĭef _greenlet_throw ( greenlet, exc, value, tb ): current = gmain def _greenlet_start ( greenlet, args ):Īrgs, kwds = args _tls. # create the main greenlet for this thread _tls. # _ # Internal stuff try :įrom threading import local as _local except ImportError :Ĭlass _local ( object ): # assume no threads pass _tls = _local ( ) f_back # go past start ( ), _switch ( ), switch ( ) # xxx this doesn ' t work when called on either the current or # the main greenlet of another thread if self is getcurrent ( ):į = _continulet. _started and not self property def gr_frame ( self ): is_pending ( self property def dead ( self ): Return args, kwds return kwds elif len ( args ) = 1: Unbound_method = getattr ( _continulet, methodname )Īrgs, kwds = unbound_method ( current, *baseargs, to=target ) parent # convert a " raise GreenletExit " into " return GreenletExit "īaseargs = sys. ![]() # will show that the program is caught in this loop here. infinite loop possible, but unlikely, unless you mess _started = True break # already done, go to the parent instead # ( NB. _init_ ( target, greenlet_func, *baseargs ) Greenlet_func = _greenlet_throw _continulet. # inlined _nonzero_ ^^^ in case it ' s overridden if not target. While not ( target._main or _continulet.is_pending(target) ): _switch ( 'throw', typ, val, tb )ĭef _switch ( target, methodname, *baseargs ): " raise exception in greenlet, return value passed when switching back " _switch ( 'switch', (args, kwds) )ĭef throw ( self, typ=GreenletExit, val=None, tb=None ): Returns the value passed when switching back. " Switch execution to this greenlet, optionally passing the values " parent = parent def switch ( self, *args, **kwds ): Return self def _init_ ( self, run=None, parent=None ): continulet class greenlet ( _continulet ):Įrror = error GreenletExit = GreenletExit _main = False _started = False def _new_ ( cls, *args, **kwds ): current # _ # The ' greenlet ' class _continulet = _continuation. # first call in this thread : current = main _green_create_main ( ) """ This special exception does not propagate to the parent greenlet itĬan be used to kill a single greenlet. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |