Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from multiprocessing import Process
- class MyProcess(Process):
- def __init__(self, msg):
- super(MyProcess, self).__init__()
- self.msg = msg
- def run(self):
- print self.msg
- def f(msg):
- print msg
- def main():
- p = Process(target=f, args = ("I'm child", ))
- p.start()
- p.join()
- # using MyProcess class
- p = MyProcess("I'm child")
- p.start()
- p.join()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement