[#64703] Add `Hash#fetch_at` (issue #10017) — Wojtek Mach <wojtek@...>
Hey guys
1 message
2014/09/01
[#64711] [ruby-trunk - Bug #10193] [Closed] TestIO#test_readpartial_locktmp fails randomly — nobu@...
Issue #10193 has been updated by Nobuyoshi Nakada.
3 messages
2014/09/02
[#64744] [ruby-trunk - Bug #10202] [Open] TestBenchmark#test_realtime_output breaks on ARM — v.ondruch@...
Issue #10202 has been reported by Vit Ondruch.
3 messages
2014/09/03
[#64823] documenting constants — Xavier Noria <fxn@...>
I am writing a Rails guide about constant autoloading in Ruby on
5 messages
2014/09/07
[#64838] [ruby-trunk - Bug #10212] [Open] MRI is not for lambda calculus — ko1@...
Issue #10212 has been reported by Koichi Sasada.
6 messages
2014/09/08
[#64858] Re: [ruby-trunk - Bug #10212] [Open] MRI is not for lambda calculus
— Eric Wong <normalperson@...>
2014/09/08
rb_env_t may use a flexible array, helps a little even on my busy system:
[#64871] Re: [ruby-trunk - Bug #10212] [Open] MRI is not for lambda calculus
— SASADA Koichi <ko1@...>
2014/09/08
(2014/09/08 19:48), Eric Wong wrote:
[#64972] [ruby-trunk - Bug #10231] [Open] Process.detach(pid) defines new singleton classes every call — headius@...
Issue #10231 has been reported by Charles Nutter.
3 messages
2014/09/11
[#64980] [ruby-trunk - Bug #10212] MRI is not for lambda calculus — ko1@...
Issue #10212 has been updated by Koichi Sasada.
4 messages
2014/09/12
[#65142] [ruby-trunk - Feature #10267] [Open] Number of processors — akr@...
Issue #10267 has been reported by Akira Tanaka.
4 messages
2014/09/20
[#65144] Re: [ruby-trunk - Feature #10267] [Open] Number of processors
— Eric Wong <normalperson@...>
2014/09/20
akr@fsij.org wrote:
[#65210] [ruby-trunk - misc #10278] [Assigned] [RFC] st.c: use ccan linked list — nobu@...
Issue #10278 has been updated by Nobuyoshi Nakada.
3 messages
2014/09/22
[ruby-core:64975] Re: [ruby-trunk - Bug #10231] [Open] Process.detach(pid) defines new singleton classes every call
From:
Eric Wong <normalperson@...>
Date:
2014-09-11 21:17:27 UTC
List:
ruby-core #64975
I haven't checked the inits.c ordering change closely, but
make check and test-rubyspec passes:
diff --git a/inits.c b/inits.c
index fe0aade..da8cfb1 100644
--- a/inits.c
+++ b/inits.c
@@ -46,7 +46,6 @@ rb_call_inits(void)
CALL(Time);
CALL(Random);
CALL(signal);
- CALL(process);
CALL(load);
CALL(Proc);
CALL(Binding);
@@ -56,6 +55,7 @@ rb_call_inits(void)
CALL(VM);
CALL(ISeq);
CALL(Thread);
+ CALL(process);
CALL(Cont);
CALL(Rational);
CALL(Complex);
diff --git a/process.c b/process.c
index 8bb52f7..5bf59ac 100644
--- a/process.c
+++ b/process.c
@@ -1007,6 +1007,8 @@ proc_waitall(void)
return result;
}
+static VALUE rb_cWaiter;
+
static inline ID
id_pid(void)
{
@@ -1038,7 +1040,7 @@ rb_detach_process(rb_pid_t pid)
{
VALUE watcher = rb_thread_create(detach_process_watcher, (void*)(VALUE)pid);
rb_thread_local_aset(watcher, id_pid(), PIDT2NUM(pid));
- rb_define_singleton_method(watcher, "pid", detach_process_pid, 0);
+ RBASIC_SET_CLASS(watcher, rb_cWaiter);
return watcher;
}
@@ -7516,6 +7518,10 @@ Init_process(void)
rb_define_module_function(rb_mProcess, "waitall", proc_waitall, 0);
rb_define_module_function(rb_mProcess, "detach", proc_detach, 1);
+ rb_cWaiter = rb_define_class_under(rb_mProcess, "Waiter", rb_cThread);
+ rb_undef_method(CLASS_OF(rb_cWaiter), "new");
+ rb_define_method(rb_cWaiter, "pid", detach_process_pid, 0);
+
rb_cProcessStatus = rb_define_class_under(rb_mProcess, "Status", rb_cObject);
rb_undef_method(CLASS_OF(rb_cProcessStatus), "new");
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 608d663..a3fa36e 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1965,4 +1965,10 @@ EOS
runner.close
end
end if defined?(fork)
+
+ def test_process_detach
+ pid = fork {}
+ th = Process.detach(pid)
+ assert_equal pid, th.pid
+ end if defined?(fork)
end
--
EW