Skip to content

Commit

Permalink
Handle the few supported signals on R-J.
Browse files Browse the repository at this point in the history
  • Loading branch information
peschwa committed Apr 29, 2016
1 parent eaa5834 commit 1acf805
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/core/Kernel.pm
Expand Up @@ -97,8 +97,13 @@ class Kernel does Systemic {
$!bits //= $.hardware ~~ m/_64|w|amd64/ ?? 64 !! 32; # naive approach
}

#?if moar
has @!signals; # Signal
#?if jvm
method signals (Kernel:D:) {
@!signals //= [2, 9]
}
#?endif
#?if moar
method signals (Kernel:D:) {
once {
my @names;
Expand All @@ -120,6 +125,7 @@ class Kernel does Systemic {
}
@!signals
}
#?endif

has %!signals_by_Str;
proto method signal (|) { * }
Expand All @@ -141,7 +147,6 @@ class Kernel does Systemic {
}

multi method signal(Kernel:D: Int:D $signal --> Int) { $signal }
#?endif
}

Rakudo::Internals.REGISTER-DYNAMIC: '$*KERNEL', {
Expand Down
9 changes: 8 additions & 1 deletion src/core/signals.pm
Expand Up @@ -15,15 +15,20 @@ sub signal(Signal $signal, *@signals, :$scheduler = $*SCHEDULER) {
@signals .= unique;

state %sigmap =
#?if moar
SIGHUP, nqp::const::SIG_HUP,
#?endif
SIGINT, nqp::const::SIG_INT,
#?if moar
SIGQUIT, nqp::const::SIG_QUIT,
SIGILL, nqp::const::SIG_ILL,
SIGTRAP, nqp::const::SIG_TRAP,
SIGABRT, nqp::const::SIG_ABRT,
SIGEMT, nqp::const::SIG_EMT,
SIGFPE, nqp::const::SIG_FPE,
#?endif
SIGKILL, nqp::const::SIG_KILL,
#?if moar
SIGBUS, nqp::const::SIG_BUS,
SIGSEGV, nqp::const::SIG_SEGV,
SIGSYS, nqp::const::SIG_SYS,
Expand All @@ -49,7 +54,9 @@ sub signal(Signal $signal, *@signals, :$scheduler = $*SCHEDULER) {
SIGTHR, nqp::const::SIG_THR,
SIGSTKFLT,nqp::const::SIG_STKFLT,
SIGPWR, nqp::const::SIG_PWR,
SIGBREAK, nqp::const::SIG_BREAK;
SIGBREAK, nqp::const::SIG_BREAK
#?endif
;

state @known_signals := $*KERNEL.signals;

Expand Down
1 change: 1 addition & 0 deletions tools/build/Makefile-JVM.in
Expand Up @@ -190,6 +190,7 @@ J_CORE_SOURCES = \
src/core/Systemic.pm \
src/core/VM.pm \
src/core/Distro.pm \
src/core/signals.pm \
src/core/Kernel.pm \
src/core/Compiler.pm \
src/core/Perl.pm \
Expand Down

0 comments on commit 1acf805

Please sign in to comment.