Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import eventlet
import eventlet.corolocal
import time
def print_thread(prefix):
while True:
ident = eventlet.corolocal.get_ident()
print "%s (%s): %s" % (prefix, ident, time.time())
eventlet.sleep(2)
for i in range(2):
eventlet.spawn_n(print_thread, 'child%d' % i)
eventlet.sleep(0.5)
print_thread('main ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment