newbie in threading

Martin von Loewis loewis at informatik.hu-berlin.de
Mon Nov 19 10:49:50 EST 2001


Stefan Antoni <sasoft at gmx.de> writes:

> 1. threads will never terminate in python, the'll live=20
>    on during the whole runtime,

Wrong. Threads terminate when their thread function completes.

>    but i can modify them to be inactive using an "threading.Event"

There are different synchronization mechanisms; Events are one of
them.

> 2. what does thread.join exactly?

Just like the documentation says

# Wait until the thread terminates. This blocks the calling thread
# until the thread whose join() method is called terminates - either
# normally or through an unhandled exception - or until the optional
# timeout occurs.

> 3. is a bunch of inactive threads able to slow down my program, or will
>    the gc clean them up for me? should i do a "del myThread" for saving
>    memory?

Neither, nor. Inactive threads won't slow down other threads, but they
won't be collected. They have to terminate themselves.

Regards,
Martin



More information about the Python-list mailing list