Skip to content

Instantly share code, notes, and snippets.

@amotoki
Created January 29, 2014 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amotoki/8684129 to your computer and use it in GitHub Desktop.
Save amotoki/8684129 to your computer and use it in GitHub Desktop.
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