Catching signals with D

Jonathan M Davis jmdavisProg at gmx.com
Sat Dec 24 12:58:06 PST 2011


On Saturday, December 24, 2011 10:58:19 Andrew Wiley wrote:
> On Sat, Dec 24, 2011 at 7:37 AM, Matej Nanut <matejnanut at gmail.com> wrote:
> > @Heywood Floyd: that works, but what exactly am I permitted to use
> > inside
> > the handler, as I assume it's a C function? This might be a useless
> > question as non-atomic operations touching global data aren't supposed
> > to be in signal handlers, but I'm still interested to know.
> > 
> > @Alex Rønne Petersen: what exactly is
> > https://github.com/D-Programming-Language/druntime/blob/master/src/core/
> > sys/posix/signal.d? I don't see it mentioned anywhere on dlang.org? :/
> > I'm still new to all this stuff. When programming in C, everything I
> > ever needed was in the default repositories of my Linux distribution,
> > so I neved needed to worry about anything. :)
> 
> That module is part of druntime, and you can import it with
> import core.sys.posix.signal;
> 
> The documentation isn't on dlang.org, probably because dlang.org
> doesn't contain the documentation for OS-specific modules (it's hard
> to generate the documentation for those when you're not on the same
> OS).

It's really not all that hard thanks to version blocks, but you do have to do 
some work to make it happen. It's more a case of the fact that druntime 
doesn't document C stuff in general. It's been argued that it should, and it's 
been argued that you should just look at the C docs if you want to see what 
they do. The reality is that it should probably document which C declarations 
that it has but not actually say what they do (leaving that up to the proper C 
documentation), but even assuming that that were agreed upon, an effort would 
have to be made to make that happen, and that hasn't happened.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list