Front page | perl.perl5.porters |
Postings from May 2002
Re: end of main thread
Thread Previous
|
Thread Next
From:
Jarkko Hietaniemi
Date:
May 12, 2002 12:21
Subject:
Re: end of main thread
Message ID:
20020512222110.I18259@alpha.hut.fi
On Sun, May 12, 2002 at 09:11:22PM +0200, Arthur Bergman wrote:
>
> On söndag, maj 12, 2002, at 09:07 , Jarkko Hietaniemi wrote:
>
> > Maybe this should be an option?
> >
> > use threads waitall => 1; # the default being not to wait
> >
>
> Why not make it default?
I'm ambivalent, too... But yes, waiting for all the threads
is proabably more intuitive. Though, as Dan points, maybe
by default wait only up to some time limit.
How about this:
(1) By default wait up to 60 seconds, reaping the threads.
If threads still are active after that, leave with the message.
(2) One can specify
use threads wait => 0;
to get the current ithreads behaviour, that is, main
thread exits when it's ready without waiting, leave with the message.
(3) One can specify
use threads wait_for => 10;
to change the maximum time limit,
use threads wait_for => -1;
to wait for ever.
> >> With 5005 threads.
> >> localhost% ./perl -le 'use Thread qw(async); async { print time; sleep
> >> 10; print time };'
> >> 1021047645
> >> 1021047655
> >>
> >> With ithreads
> >>
> >> ./perl -le 'use Thread qw(async); async { print time; sleep 10; print
> >> time };'
> >> 1021047681
> >> Cleanup skipped 2 active threads.
> >>
> >> I personally think the second follows the rule of least surprise.
> >>
> >> Arthur
> >
>
> I meant the first follows the rule of least surprise!
>
> Arthur
>
--
$jhi++; # http://www.iki.fi/jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
Thread Previous
|
Thread Next