Skip to content

Instantly share code, notes, and snippets.

@mgoldey
Created February 26, 2018 21:31
Show Gist options
  • Save mgoldey/a3e571081243a3dc902ca1397ea19f2a to your computer and use it in GitHub Desktop.
Save mgoldey/a3e571081243a3dc902ca1397ea19f2a to your computer and use it in GitHub Desktop.
hello world using tornado threads
import tornado.gen
import tornado.process
import time
@tornado.gen.coroutine
def launch(pid):
time.sleep(0.01 * pid)
if pid != None:
print("hello, world from process {:}".format(pid + 1))
def main():
pid = tornado.process.fork_processes(None)
launch(pid)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment