Commit 0a5df698 authored by Denis Bilenko's avatar Denis Bilenko

rename gevent.run() -> gevent.wait()

parent 5b96b1b9
...@@ -78,7 +78,7 @@ def main(): ...@@ -78,7 +78,7 @@ def main():
gevent.signal(signal.SIGTERM, server.close) gevent.signal(signal.SIGTERM, server.close)
gevent.signal(signal.SIGINT, server.close) gevent.signal(signal.SIGINT, server.close)
server.start() server.start()
gevent.run() gevent.wait()
def log(message, *args): def log(message, *args):
......
...@@ -166,6 +166,6 @@ if __name__ == '__main__': ...@@ -166,6 +166,6 @@ if __name__ == '__main__':
start = time.time() start = time.time()
for _ in xrange(4): for _ in xrange(4):
gevent.spawn(pool.execute, 'select pg_sleep(1);') gevent.spawn(pool.execute, 'select pg_sleep(1);')
gevent.run() gevent.wait()
delay = time.time() - start delay = time.time() - start
print 'Running "select pg_sleep(1);" 4 times with 3 connections. Should take about 2 seconds: %.2fs' % delay print 'Running "select pg_sleep(1);" 4 times with 3 connections. Should take about 2 seconds: %.2fs' % delay
...@@ -7,6 +7,6 @@ pool = ThreadPool(3) ...@@ -7,6 +7,6 @@ pool = ThreadPool(3)
start = time.time() start = time.time()
for _ in xrange(4): for _ in xrange(4):
pool.spawn(time.sleep, 1) pool.spawn(time.sleep, 1)
gevent.run() gevent.wait()
delay = time.time() - start delay = time.time() - start
print 'Running "time.sleep(1)" 4 times with 3 threads. Should take about 2 seconds: %.3fs' % delay print 'Running "time.sleep(1)" 4 times with 3 threads. Should take about 2 seconds: %.3fs' % delay
...@@ -29,7 +29,7 @@ __all__ = ['get_hub', ...@@ -29,7 +29,7 @@ __all__ = ['get_hub',
'signal', 'signal',
'fork', 'fork',
'reinit', 'reinit',
'run'] 'wait']
import sys import sys
...@@ -50,5 +50,8 @@ except ImportError: ...@@ -50,5 +50,8 @@ except ImportError:
__all__.remove('fork') __all__.remove('fork')
def run(timeout=None, event=None): def wait(timeout=None, event=None):
return get_hub().join(timeout=timeout, event=event) return get_hub().join(timeout=timeout, event=event)
run = wait # XXX to be deleted (soon)
...@@ -67,7 +67,7 @@ def run_many(tests, expected=None): ...@@ -67,7 +67,7 @@ def run_many(tests, expected=None):
for name, cmd, options in tests: for name, cmd, options in tests:
total += 1 total += 1
spawn(run_one, name, cmd, **options) spawn(run_one, name, cmd, **options)
gevent.run() gevent.wait()
except KeyboardInterrupt: except KeyboardInterrupt:
try: try:
if pool: if pool:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment