Skip to content

Instantly share code, notes, and snippets.

@4383
Last active June 4, 2019 17:04
Show Gist options
  • Save 4383/1ac3a2c2cbd6d7a54046d4585ecef151 to your computer and use it in GitHub Desktop.
Save 4383/1ac3a2c2cbd6d7a54046d4585ecef151 to your computer and use it in GitHub Desktop.
always use pthread on monkey patched environment
import eventlet
eventlet.monkey_patch()
if eventlet.patcher.is_monkey_patched("thread"):
print("Patched")
threading = eventlet.patcher.original("threading")
else:
print("Not Patched")
import threading
print(threading.current_thread.__module__)
# Will print 'threading'
assert threading.current_thread.__module__ == 'threading'
# No error will raised
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment