You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
471 B
32 lines
471 B
5 years ago
|
import gevent
|
||
|
from gevent.hub import get_hub
|
||
|
|
||
|
called = []
|
||
|
|
||
|
|
||
|
def f():
|
||
|
called.append(1)
|
||
|
|
||
|
|
||
|
def main():
|
||
|
loop = get_hub().loop
|
||
|
x = loop.run_callback(f)
|
||
|
|
||
|
assert x, x
|
||
|
gevent.sleep(0)
|
||
|
assert called == [1], called
|
||
|
assert not x, (x, bool(x))
|
||
|
|
||
|
x = loop.run_callback(f)
|
||
|
assert x, x
|
||
|
x.stop()
|
||
|
assert not x, x
|
||
|
gevent.sleep(0)
|
||
|
assert called == [1], called
|
||
|
assert not x, x
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
called[:] = []
|
||
|
main()
|