[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Segfault - a hard one

From: Vincent Manis
Subject: Re: [Chicken-users] Segfault - a hard one
Date: Thu, 7 Aug 2008 08:28:31 -0700

On 2008-Aug-7, at 06:04, felix winkelmann wrote:

It must be added that `thread-terminate!' is a "problematic"
function: terminating a thread forcefully destroy an execution
context that doesn't necessarily expect to be terminated and
may leave any kind of system in an inconsistent state.
In fact, `thread-terminate!' shouldn't be used at all. That is
not meant as an excuse - chicken provides it, so it should
work, but it is a dangerous device in general.

I'd be a bit stronger than Felix on this...fine if thread-terminate can be
made to work, but it's almost impossible to design correct software that
allows one thread (or process) to terminate another. Basically, the
victim thread might be in any state at all, and therefore it's more or less
impossible to ensure that whatever global invariants must be preserved
are indeed preserved when the thread actually dies. Testing is also close
to impossible in the presence of thread termination.

Of course, this doesn't apply if the victim thread is allowed to intercept the terminate request, and execute a shutdown handler, but then it really isn't a true termination (the killer thread can't be sure that the victim is
in fact dead).

I'd prefer to have the manual document that to the best of our knowledge
thread-terminate works `correctly', but that its use is fraught with design
and testing problems, and therefore it should be avoided.

-- v

reply via email to

[Prev in Thread] Current Thread [Next in Thread]