From: nospam at bitbucket.com (Phil Mayes)
Date: Sat, 1 May 1999 18:39:35 -0700
Subject: Newbie Threads question
References: <7gfdrm$69t$1@nnrp1.dejanews.com>
Message-ID: <u1OW2.28$Xw.35145@newsfeed.avtel.net>
Content-Length: 1208
X-UID: 1937                                                 

Michael "Fred" Fredericks wrote in message
<7gfdrm$69t$1 at nnrp1.dejanews.com>...
>What I'd like to do is learn how to use threads by "parallelizing" a simple
>set of now currently serialized tasks.
> [sample code snipped]
>#my new main loop
>list1 = thread.start_new_thread(func1,(x))
>list2 = thread.start_new_thread(func2,(y))
>reallist = func3(list1,list2)
>
>I have read the documentation a couple of times, but what I don't know:
>[...]
>B) Do I need to do anything fancy to make the func3 call wait until the
calls
>to func1 and func2 have both returned? For example, should I have the func1
>and func2 calls aquire a lock at the start of the function and release it
at
>the end, and then make the main loop try to acquire both locks before
>proceeding to the reallist = func3() call?  If I did this, could the main
>loop acquire the locks before the new threads do, causing deadlock?


There is a nifty class called WorkQ that will wait on N threads in
    python\python-1.5.2\demo\threads\find.py
courtesy of Guido.  You may need to download the source-code to get this --
not sure.
--
Phil Mayes    pmayes AT olivebr DOT com
Olive Branch Software - home of Arranger http://www.olivebr.com/








