summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-07 09:31:28 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-07 09:31:28 -0700
commitcd8e03d083ec0aae5e7420765404d306f9a347cb (patch)
tree894091a0476eddcf576ebb14fbbe1c2663c3071c
parent28c640e34797b30dcd43ef8191b2ffe126f0feb8 (diff)
downloadtxr-cd8e03d083ec0aae5e7420765404d306f9a347cb.tar.gz
txr-cd8e03d083ec0aae5e7420765404d306f9a347cb.tar.bz2
txr-cd8e03d083ec0aae5e7420765404d306f9a347cb.zip
Adding raise function.
* signal.c (raise_wrap): New static function (sig_init): Register raise intrinsic. * txr.1: Documented raise.
-rw-r--r--signal.c7
-rw-r--r--txr.117
2 files changed, 24 insertions, 0 deletions
diff --git a/signal.c b/signal.c
index 220b81e6..e5649f7a 100644
--- a/signal.c
+++ b/signal.c
@@ -116,6 +116,12 @@ static val kill_wrap(val pid, val sig)
return num(kill(p, s));
}
+static val raise_wrap(val sig)
+{
+ int res = raise(c_num(sig));
+ return tnil(res == 0);
+}
+
void sig_init(void)
{
int i;
@@ -188,6 +194,7 @@ void sig_init(void)
reg_fun(intern(lit("get-sig-handler"), user_package), func_n1(get_sig_handler));
reg_fun(intern(lit("sig-check"), user_package), func_n0(sig_check));
reg_fun(intern(lit("kill"), user_package), func_n2o(kill_wrap, 1));
+ reg_fun(intern(lit("raise"), user_package), func_n1(raise_wrap));
sig_reload_cache();
}
diff --git a/txr.1 b/txr.1
index 1ebee7c4..067bbb7b 100644
--- a/txr.1
+++ b/txr.1
@@ -31285,6 +31285,23 @@ function may be inserted into CPU-intensive code that
has no opportunity to be interrupted by signals, because it doesn't invoke any
I/O functions.
+.coNP Function @ raise
+.synb
+.mets (raise << signal )
+.syne
+.desc
+The
+.code raise
+function sends
+.meta signal
+to the process.
+It is a wrapper for the C function of the same name.
+
+The return value is
+.code t
+if the function succeeds, otherwise
+.codn nil .
+
.coNP Function @ kill
.synb
.mets (kill < process-id <> [ signal ])