From: co000ri@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:81617] [Ruby trunk Feature#13639] Add "RTMIN" and "RTMAX" to Signal.list
Date: Thu, 08 Jun 2017 05:22:29 +0000 [thread overview]
Message-ID: <redmine.issue-13639.20170608052229.29444718a0596635@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-13639.20170608052229@ruby-lang.org
Issue #13639 has been reported by ksss (Yuki Kurihara).
----------------------------------------
Feature #13639: Add "RTMIN" and "RTMAX" to Signal.list
https://bugs.ruby-lang.org/issues/13639
* Author: ksss (Yuki Kurihara)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
I propose to add the key "RTMIN" and "RTMAX" to Signal.list
Currently, We can't know signal number for realtime-signal at own environment in Ruby.
And it's not potable if hard code number literal.
So, How about this idea?
Use case:
~~~ruby
unless Signal.list["RTMIN"]
raise "realtime-signal does not supported"
end
MY_SIGNAL = Signal.list["RTMIN"] + 1
Signal.trap(MY_SIGNAL) do |i|
puts "Hello MY_SIGNAL"
end
Process.kill(MY_SIGNAL, $$)
#=> "Hello MY_SIGNAL"
~~~
Patch:
~~~diff
diff --git a/signal.c b/signal.c
index 8ee0963b8a..f17836350a 100644
--- a/signal.c
+++ b/signal.c
@@ -1381,6 +1381,12 @@ sig_list(void)
for (sigs = siglist; sigs->signm; sigs++) {
rb_hash_aset(h, rb_fstring_cstr(sigs->signm), INT2FIX(sigs->signo));
}
+#ifdef SIGRTMIN
+ rb_hash_aset(h, rb_fstring_cstr("RTMIN"), INT2FIX(SIGRTMIN));
+#endif
+#ifdef SIGRTMAX
+ rb_hash_aset(h, rb_fstring_cstr("RTMAX"), INT2FIX(SIGRTMAX));
+#endif
return h;
}
~~~
Inspired by https://github.com/ksss/mruby-signal/pull/3 and @takumakume
--
https://bugs.ruby-lang.org/
next parent reply other threads:[~2017-06-08 5:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-13639.20170608052229@ruby-lang.org>
2017-06-08 5:22 ` co000ri [this message]
2017-08-31 9:06 ` [ruby-core:82578] [Ruby trunk Feature#13639] Add "RTMIN" and "RTMAX" to Signal.list matz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.issue-13639.20170608052229.29444718a0596635@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).