Re: [RFC] Stringify a thread

[email protected] (Nicholas Clark) Wed, 4 Oct 2006 20:43:02 +0100
Newsgroups perl.perl5.porters,perl.ithreads
Message-ID <[email protected]>
On Wed, Oct 04, 2006 at 12:36:32PM -0700, Jerry Hedden wrote:
> I'm considering a one line addition to the threads module to overload
> the string value of a thread to return its ID:
> 
>   '""' => sub { shift->tid() }
> 
> Since thread IDs are unique, thread objects could be used as hash keys
> in a more rational way:
> 
>   $timeouts{$thr} = $secs;
> 
> Also, it would also simply such things as:
> 
>   print("Thread $thr running...\n");
> 
> Comments?

I can't see that it's backwards compatible.

Nicholas Clark