On Wed, 5 Jul 2006, Jerry D. Hedden wrote:
> Mike Pomraning wrote:
> > Thread::Running's threads->tojoin suggests that a class method to return all
> > nondetached, nonrunning and nonjoined threads is useful.
>
> This would be syntactical sugar for:
>
> my @joinable = grep { $_->is_joinable() } threads->list();
Would also be the equiv. of
my @join = grep { !$_->running() } threads->list();
since list already filters out unjoinable (joined or detached) threads.
> However, I would rather 'enhance' the syntax for threads->list() to take
> a parameter to return that kind of information:
>
> my @joinable = threads->list(threads::joinable);
>
> where the parameter would be defined as a 'constant' in threads.pm:
>
> sub threads::joinable { 0 };
>
> Similarly, we would have:
>
> sub threads::running { 1 };
>
> my @running = threads->list(threads::running);
>
> Or am I making things too hard?
A little inobvious, IMHO, given the filtering threads::list already does.
-Mike
--
cat: .signature: Invalid request descriptor