On Wed, 5 Jul 2006, Jerry D. Hedden wrote:

> I'm planning to add some new methods to the 'threads' module, and I
> would like a concensus on the method names:

I'm partial to 'running', 'detached', and the like.

> Method to tell if a thread is still 'running' (i.e., the thread entry
> point function has not yet exited).  Possible names:
>    $thr->running()
>    $thr->isrunning()
>    $thr->is_running()
> 
> Method to tell if a thread is detached.  Possible names:
>    $thr->detached()
>    $thr->isdetached()
>    $thr->is_detached()
> 
> Method to tell if a thread is ready to be joined.  This returns true if
> a thread is not detached, is no longer running, and has not been
> previously joined.  Possible names:
>    $thr->joinable()
<<SNIP>>

I find the name "joinable" and its variants a bit misleading here.  I think
of any non-detached, non-joined thread as joinable per se.  Whether or not a
join() would block until target thread completion is a separate concern.

How about a method $thr->joined(), instead, which returns true if the object
has been successfully joined already?  That method, 'running' and 'detached'
give one everything to implement the non-blocking join check oneself.

> Suggestions for other methods would also be welcomed.

Thread::Running's threads->tojoin suggests that a class method to return all
nondetached, nonrunning and nonjoined threads is useful.  (As opposed to an
object method to do much the same per-object.)

-Mike
-- 
cat: .signature: Protocol driver not attached

Reply via email to