chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] thread-wait-for-i/o! and thread-terminate!


From: Jörg F. Wittenberger
Subject: Re: [Chicken-users] thread-wait-for-i/o! and thread-terminate!
Date: Wed, 21 Jan 2015 08:51:50 +0100
User-agent: Mozilla/5.0 (X11; Linux armv7l; rv:31.0) Gecko/20100101 Icedove/31.3.0

Am 20.01.2015 um 23:41 schrieb address@hidden:
> Chris Vine:
> 
>> Does anyone know if thread-terminate! can safely be called on a
>> thread which is blocking on thread-wait-for-i/o!, without putting
>> chicken's internals into an inconsistent state.
> 
> Calling thread-terminate! in any circumstances may put your code
> into a bad state, because it unlocks mutexes without letting the
> user data structures that those mutexes protect be unwound.
> In general, terminating threads from outside is always a Bad Thing.

John is right about the general case.  There are however circumstances
when you just want to abort some operation.  If you know what you do,
external abort is sometimes ok.  Most of the time however I'd recommend
to use thread-signal! to allow the terminated thread receive an
exception and abort cleanly.

Chicken _itself_ however should not end up in an inconsistent state
because of thread-terminate!.




reply via email to

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