[libdispatch-dev] What's with this sigsuspend stuff?

Mark Heily mark at heily.com
Thu Jul 7 17:11:28 PDT 2011


On 07/05/2011 02:43 AM, Paolo Bonzini wrote:
> On 07/05/2011 03:03 AM, Dave Zarzycki wrote:
>> On Mac OS X and iOS, some signals are only deliverable on the thread
>> that they were generated from (SIGILL, SIGFPE, SIGBUS, SIGSEGV, etc),
>> therefore, we shouldn't mask those off. Someday, if/when the Mac OS X
>> / iOS kernel supports delivering those signals to any available
>> thread, then we can fully mask every signal on GCD threads.
>
> That would not be POSIX-compliant.
>

I think the idea would be that a GCD-based program could request the 
non-standard behavior, while all other programs will get the standard 
POSIX behavior by default.

On a related note, here's an interesting question about installing a 
signal handler for SIGSEGV in a libdispatch-based program. I haven't 
tried this, but does anyone know if it's possible to install a signal 
handler for SIGSEGV that would be propagated to all of the GCD worker 
threads?

Thanks,

  - Mark

-------- Original Message --------
Subject: Catching SIGSEGV in a libdispatch program
Date: Thu, 07 Jul 2011 19:30:50 +0200
From: Julien BLACHE <jb at jblache.org>
To: Mark Heily <mark at heily.com>

Hi Mark,

Just a quick question about catching SIGSEGV in a libdispatch program.

Here's the context: under normal circumstances, I'm using a dedicated
queue for all logging operations so logging becomes asynchronous. For
debugging purposes, logging can be made synchronous, but as you guess,
it changes dramatically the execution profile and quite a few things can
become unreproducible once there's a central point of
synchronization/contention.

I'm wondering if it would be possible to catch SIGSEGV and run the
logging queue to flush the logs before aborting.

It seems difficult if not impossible given SIGSEGV is a thread-directed
signal, and I'm not sure there's a way to run a single queue to
depletion anyway.


More information about the libdispatch-dev mailing list