Created
September 30, 2011 23:43
-
-
Save mechanical-snail/1255347 to your computer and use it in GitHub Desktop.
Wrapper for multiprocessing.Process
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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