Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1386 from tomerfiliba/patch-2
Browse files Browse the repository at this point in the history
Bug 15073: statically-initialize SIGRTMIN/MAX
  • Loading branch information
MartinNowak committed Oct 12, 2015
2 parents df4d912 + bf7b39e commit d42d96c
Showing 1 changed file with 37 additions and 7 deletions.
44 changes: 37 additions & 7 deletions src/core/sys/posix/signal.d
Expand Up @@ -108,23 +108,53 @@ union sigval
version( Solaris )
{
import core.sys.posix.unistd;
private int _sigrtmin() { return cast(int) sysconf(_SC_SIGRT_MIN); }
private int _sigrtmax() { return cast(int) sysconf(_SC_SIGRT_MAX); }

alias _sigrtmin SIGRTMIN;
alias _sigrtmax SIGRTMAX;
@property int SIGRTMIN() nothrow @nogc {
__gshared static int sig = -1;
if (sig == -1) {
sig = cast(int)sysconf(_SC_SIGRT_MIN);
}
return sig;
}

@property int SIGRTMAX() nothrow @nogc {
__gshared static int sig = -1;
if (sig == -1) {
sig = cast(int)sysconf(_SC_SIGRT_MAX);
}
return sig;
}
}
else version( Posix )
else version( linux )
{
private extern (C) nothrow @nogc
{
int __libc_current_sigrtmin();
int __libc_current_sigrtmax();
}

alias __libc_current_sigrtmin SIGRTMIN;
alias __libc_current_sigrtmax SIGRTMAX;
@property int SIGRTMIN() nothrow @nogc {
__gshared static int sig = -1;
if (sig == -1) {
sig = __libc_current_sigrtmin();
}
return sig;
}

@property int SIGRTMAX() nothrow @nogc {
__gshared static int sig = -1;
if (sig == -1) {
sig = __libc_current_sigrtmax();
}
return sig;
}
}
else version (FreeBSD) {
// https://github.com/freebsd/freebsd/blob/e79c62ff68fc74d88cb6f479859f6fae9baa5101/sys/sys/signal.h#L117
enum SIGRTMIN = 65;
enum SIGRTMAX = 126;
}
// Note: it appears that FreeBSD (prior to 7) and OSX do not support realtime signals

version( linux )
{
Expand Down

0 comments on commit d42d96c

Please sign in to comment.