Hi Amaury,
 
to me,Thread objects are meant to be abstract representation of a processing that will occur in a separate execution unit at thread start time.
Indeed, that's what the following text (from the link you provided tries to explain)
 
"Once a thread object is created, its activity must be started by calling the thread’s start() method. This invokes the run() method in a separate thread of control."
 
So, the 'System Thread' is only created at start() call (which is a good implementation choice)
Moreover, the join() method (when completed) will wait for the System Thread to be disallocated.
 
However, the Thread object instance and the processing bound to it are still valid.
 
So in an object oriented point of view, (and syntactically too) , it should be valid to reuse the object (and so repeat the processing bound to it) as many times as necessary without the need to create a new instance as long as the Thread object state is not Alive.
 
What suprises me , is that the current implementation  of threading.Thread (apart from the __started flag behaviour) is compatible with that point of view and i see no limitations (apart that bug) preventing such a use of threads.
 
I think the threading API will provide better 'high-level' view if it didn't depend on low level considerations (as the dependency on the existence / reusability of the peer System Thread that will be used to effectively host the code execution)
 
Regards,
 
Sebastien





> Subject: [issue1626] threading.Thread objects are not reusable after join()
> To: dweeves@hotmail.com
> From: report@bugs.python.org
> Date: Fri, 14 Dec 2007 13:03:54 +0000
>
>
> Amaury Forgeot d'Arc added the comment:
>
> From the documentation:
> http://docs.python.org/dev/library/threading.html#threading.Thread.start
> start() must be called at most once per thread object.
>
> I think this will not change: when a system thread terminates, you
> cannot restart it; you have to create another thread.
> The same argument applies to threading.Thread. It would be surprising
> that this object can represent multiple system threads.
>
> You should create and start different Threads each time.
>
> ----------
> nosy: +amaury.forgeotdarc
> resolution: -> invalid
> status: open -> closed
>
> __________________________________
> Tracker <report@bugs.python.org>
> <http://bugs.python.org/issue1626>
> __________________________________



Express yourself instantly with MSN Messenger! MSN Messenger