Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52272

Re: Python3 Multiprocessing

Date 2013-08-09 16:43 -0400
From Devyn Collier Johnson <devyncjohnson@gmail.com>
Subject Re: Python3 Multiprocessing
References <5205435D.5090704@Gmail.com> <520546A2.50900@mrabarnett.plus.com>
Newsgroups comp.lang.python
Message-ID <mailman.407.1376081022.1251.python-list@python.org> (permalink)

Show all headers | View raw


On 08/09/2013 03:44 PM, MRAB wrote:
> On 09/08/2013 20:30, Devyn Collier Johnson wrote:
>> Aloha!
>>
>>      I need a command that will make threads created by
>> "multiprocessing.Process()" wait for each other to complete. For
>> instance, I want to do something like this:
>>
>> job1 = multiprocessing.Process(CMD1())
>> job2 = multiprocessing.Process(CMD2())
>>
>> jobs1.start(); jobs2.start()
>>
>> PY_FUNC()
>>
>> The command "PY_FUNC()" depends on the end result of the actions of
>> CMD1() and CMD2(). I need some kind of wait command for the two threads
>> that will not let the script continue until job1 and job2 are complete.
>> Is this possible in Python3?
>>
> Possibly you mean .join:
>
> jobs1.start()
> jobs2.start()
>
> jobs1.join()
> jobs2.join()
>

Thanks MRAB! That is easy. I always (incorrectly) thought the join() 
command got two threads and made them one. I did not know it made the 
script wait for the threads.

Mahalo,

DevynCJohnson@Gmail.com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python3 Multiprocessing Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-08-09 16:43 -0400

csiph-web