Exemple #1
0
def run(self):
        assert self is getcurrent(), 'Do not call Hub.run() directly'
        while True:
            #raise Exception(11)
            loop = self.loop
            loop.error_handler = self
            try:
                loop.run()
            finally:
                loop.error_handler = None  # break the refcount cycle
            self.parent.throw(LoopExit('This operation would block forever'))
from gevent.core import loop

count = 0


def incr():
    global count
    count += 1


loop = loop()
loop.run_callback(incr)
loop.run()
assert count == 1, count
Exemple #3
0
from gevent.core import loop

count = 0

def incr():
    global count
    count += 1

loop = loop()
loop.callback().start(incr)
loop.run()
assert count == 1, count