threading, how to?

Diez B. Roggisch deets at nospam.web.de
Fri Apr 21 06:50:46 EDT 2006


akrapus wrote:

> Thanks for reply.
> 
> So would it be implemented as follows:
> 
> Func 1
> Func 2
> Func 3
> 
> Thread for Func 1
> Thread for Func 2
> Thread for Func 3

Could be, but the you woul most probably subclass threading.Thread and
override the run-method.

However, often it is done like this:

def some_threaded_function():
    while though_shalt_work():
         do_work()


for i in xrange(THRAD_NUM):
    t = threading.Thread(target=some_threaded_function)
    t.start()


Diez



More information about the Python-list mailing list