[phobos] parallelism segfaults

Martin Nowak dawg at dawgfoto.de
Sun Sep 18 17:38:02 PDT 2011


As all threads are suspended for the final collection run,
one could possibly set a shared flag on runtime termination
and let the threads exit with an exception after resuming.
But this would still be after all module dtors ran.
It would be also pretty hard to find bugs triggered by this exception  
(e.g. non-scoped mutexes).


On Wed, 14 Sep 2011 21:07:21 +0200, David Simcha <dsimcha at gmail.com> wrote:

> I don't know much about these kinds of internals.  I just assumed it was
> feasible because things like SIG_TERM get sent somehow when you kill a
> process on Linux.
>
> On Wed, Sep 14, 2011 at 2:53 PM, Sean Kelly <sean at invisibleduck.org>  
> wrote:
>
>> On Sep 14, 2011, at 10:03 AM, David Simcha wrote:
>>
>> > How about this:  Could we send all daemon threads hardware exceptions
>> after joinAll()?  In the vast majority of cases, locks will be scoped,
>> either through synchronized blocks or simple scope(exit) mutex.unlock()  
>> type
>> statements.  If they're not then they should be.  (If any still aren't  
>> in
>> std.parallelism then I'll fix this.  I originally made a few non-scoped
>> around code that couldn't throw, but this was silly and I think I  
>> changed
>> all of them.)  This way daemon threads terminate immediately, locks get
>> released if the code's well-written,
>> > and if you **really** need to do some cleanup, you can catch the
>> exception.
>>
>> How would we do this?  Signals don't cause an exception to be thrown
>> (because it's technically illegal to throw from a signal handler).  Is  
>> there
>> some other way we could sent a hardware exception to a thread that would
>> cause it to terminate cleanly?
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list