RE: Thread Exit [was RE: threads change]

[email protected] ("Jerry D. Hedden") Tue, 18 Jul 2006 08:22:11 -0700
Newsgroups perl.perl5.porters,perl.ithreads
Message-ID <20060718082211.fb30e530d17747c2b054d625b8945d88.0270ee7b13.wbe@email.secureserver.net>
Jerry D. Hedden wrote:
> First of all, do we have a consensus on changing anything?
> I think so: Rafeal, Artur, Liz and Jan are in favor of the
> general concept of exit() terminating the app, and
> threads->exit() terminating the thread.  Any dissensions?

Dave Mitchell replied:
> No, I agree (it was originally my suggestion).

I'm with Dave, BTW.  I think 'exit()' in a thread should just
terminate the thread.

I know that Artur's mantra is 'threads are threads and
processes are processes', but I don't view it that way for
Perl iThreads.  For me, thread 0, the 'main' thread, isn't
really a thread; it's the main controller for the process,
and all 'created' threads are subordinate to it.  I feel
that the 'main' thread should be in control, and not be
subjugated to the whims (or poor programming) in a thread.

Jerry D. Hedden wrote:
> Next is the question of this being overridable such that
> exit() can be made to just terminate just the thread.
> Liz and Artur are in on this.  Others?

Dave Mitchell replied:
> I'm not convinced of the need. Why can't the user just do
>     BEGIN {
>         package CORE::GLOBAL;
>         sub exit { thread->exit }
>     }
> if they really wish to override the module author's wishes?

If we do change the current thread exit functionality, I
would prefer that overriding the default behavior should be
supported explicitly by the module as per my original
suggestions (i.e., use threads 'exit' => 'threads_only';, and
$thr->create({'exit' => 'thread'}, ...); ).