Skip to content

Instantly share code, notes, and snippets.

@mechanical-snail
Created September 30, 2011 23:43
Show Gist options
  • Save mechanical-snail/1255347 to your computer and use it in GitHub Desktop.
Save mechanical-snail/1255347 to your computer and use it in GitHub Desktop.
Wrapper for multiprocessing.Process
from __future__ import print_function
from multiprocessing import Process
def start_process(func):
u"""Decorator that turns the function into a subprocess and starts it asynchronously."""
process = Process(target=func)
process.start()
return process
if __name__ == "__main__":
@start_process
def hello():
print(u'Child process says hi')
print(unicode(hello))
print(u'Greetings from parent process')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment