[#2529] concerns about Proc,lambda,block — "David A. Black" <dblack@...>
Hi --
>>>>> "D" == David A Black <dblack@wobblini.net> writes:
Hi --
Hi,
On Tue, 2 Mar 2004 08:44:25 +0900, Yukihiro Matsumoto wrote:
Hi,
On Wednesday, 3 March 2004 at 8:00:09 +0900, Yukihiro Matsumoto wrote:
Hi,
Hi,
On Wed, Mar 03, 2004 at 07:51:10AM +0900, Yukihiro Matsumoto wrote:
Hi,
On Thu, 4 Mar 2004, Yukihiro Matsumoto wrote:
Hi,
[#2575] Comment football being played... with lib/test/unit.rb — Nathaniel Talbott <nathaniel@...>
[Resent because I accidentally signed it the first time]
[#2577] problem with Net::HTTP in 1.8.1 — Ian Macdonald <ian@...>
Hello,
Hi,
[#2582] One more proc question — Dave Thomas <dave@...>
Sorry about this... :)
Hi,
On Friday, 5 March 2004 at 12:52:15 +0900, Yukihiro Matsumoto wrote:
Hi,
[#2588] Duck typing chapter — Dave Thomas <dave@...>
I've posted a rough first pass at a chapter about duck typing (and
[#2606] Thought about class definitions — Dave Thomas <dave@...>
If we allowed
[#2628] YAML complaint while generating RDoc — Dave Thomas <dave@...>
With the latest CVS, I get
[#2640] patch to tempfile.rb to handle ENAMETOOLONG — Joel VanderWerf <vjoel@...>
[#2644] RDoc proporsal — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
Hi, rubyists.
[#2646] Problems rdoc'ing cvs... — Hugh Sasse Staff Elec Eng <hgs@...>
I have just done
On Friday, March 12, 2004, 4:15:42 AM, Dave wrote:
On Fri, 12 Mar 2004, Dave Thomas wrote:
[#2661] Pathological slowdown in 1.8 — Ryan Davis <ryand@...>
Hi all,
[#2697] lib/ruby/1.9/yaml.rb:193: [BUG] Segmentation fault — Mauricio Fern疣dez <batsman.geo@...>
Mauricio Fern疣dez wrote:
On Sun, Mar 28, 2004 at 09:42:42AM +0900, why the lucky stiff wrote:
[#2703] Proposed patch to add SSL support to net/pop.rb — Daniel Hobe <daniel@...>
This patch adds support to Net::POP for doing POP over SSL. Modeled on how
This is v2 of the patch. Cleaned up a bit and added some more docs.
v3 of the patch:
Hi,
I agree that there are a lot of arguments to #start, but I think it is the
On Tue, 30 Mar 2004 16:24:17 +0900, Daniel Hobe wrote:
On Wed, 31 Mar 2004 13:27:31 +0900, Daniel Hobe wrote:
On Tue, Mar 30, 2004 at 04:05:06PM +0900, Minero Aoki wrote:
[#2709] typos in lib/singleton.rb — Ian Macdonald <ian@...>
Hello,
[#2713] more spelling and grammar fixes — Ian Macdonald <ian@...>
Hello,
> Hello,
Hi,
process.c changes
All,
I stumbled across Curt Tilmes' Proc::Wait3 Perl module and it made me
think that Ruby (and probably Perl) should have this built-in. I
whipped this up quick and it seems to work alright. I felt a struct was
nicer than returning a huge array (as Chris does), but that can be
changed easily enough. These two functions could also be reduced to one
function (with a few more "if" statements) if you really wanted.
If this patch is accepted, then I would also suggest deprecating
wait2/waitpid2, since they don't provide any information that
wait3/waitpid3 don't provide (and the latter provide much more).
Regards,
Daniel Berger
= SAMPLE SCRIPTS =
# test_wait3.rb
fork{
sleep 5
exit 1
}
#p Process.wait3(Process::WNOHANG)
p Process.wait3
# test_waitpid3.rb
pid = fork{ sleep 3 }
p Time.now
p Process.waitpid3(pid,Process::WNOHANG)
p Time.now
p Process.waitpid3(pid)
p Time.now
= DIFF FILE =
--- process.c Tue Mar 9 14:00:09 2004
+++ ../ruby-1.8.1/process.c Wed Dec 10 00:57:06 2003
@@ -456,105 +456,6 @@
return rb_assoc_new(pid, rb_last_status);
}
-static VALUE proc_wait3(int argc, VALUE *argv){
- int status;
- int flags = 0;
- struct rusage r;
- pid_t pid;
- VALUE rbFlags = Qnil;
- VALUE rbStruct =
rb_struct_define("ProcStruct","pid","status","utime","stime",
- "maxrss","minflt","majflt","nswap","inblock","oublock","msgsnd",
- "msgrcv","nsignals","nvcsw","nivcsw",0
- );
-
- rb_scan_args(argc,argv,"01",&rbFlags);
-
- if(Qnil != rbFlags){
- flags = NUM2INT(rbFlags);
- }
-
- pid = wait3(&status, flags, &r);
- if(pid < 0){
- rb_sys_fail(0);
- }
- else if(pid > 0){
- return rb_struct_new(rbStruct,
- INT2NUM(pid),
- INT2NUM(status),
- INT2NUM(r.ru_utime.tv_sec + (r.ru_utime.tv_usec/1000.0)),
- INT2NUM(r.ru_stime.tv_sec + (r.ru_stime.tv_usec/1000.0)),
- INT2NUM(r.ru_maxrss),
- INT2NUM(r.ru_ixrss),
- INT2NUM(r.ru_idrss),
- INT2NUM(r.ru_isrss),
- INT2NUM(r.ru_minflt),
- INT2NUM(r.ru_majflt),
- INT2NUM(r.ru_nswap),
- INT2NUM(r.ru_inblock),
- INT2NUM(r.ru_oublock),
- INT2NUM(r.ru_msgsnd),
- INT2NUM(r.ru_msgrcv),
- INT2NUM(r.ru_nsignals),
- INT2NUM(r.ru_nvcsw),
- INT2NUM(r.ru_nivcsw)
- );
- }
- else{
- return rb_last_status = Qnil;
- }
-}
-
-/* wait4 is actually waitpid3 - who comes up with this? */
-static VALUE proc_waitpid3(int argc, VALUE *argv){
- int status;
- int flags = 0;
- struct rusage r;
- pid_t pid;
- VALUE rbPid;
- VALUE rbFlags = Qnil;
- VALUE rbStruct =
rb_struct_define("ProcStruct","pid","status","utime","stime",
- "maxrss","minflt","majflt","nswap","inblock","oublock","msgsnd",
- "msgrcv","nsignals","nvcsw","nivcsw",0
- );
-
- rb_scan_args(argc,argv,"11",&rbPid,&rbFlags);
- pid = NUM2INT(rbPid);
-
- if(Qnil != rbFlags){
- flags = NUM2INT(rbFlags);
- }
-
- pid = wait4(pid, &status, flags, &r);
- if(pid < 0){
- rb_sys_fail(0);
- }
- else if(pid > 0){
- return rb_struct_new(rbStruct,
- INT2NUM(pid),
- INT2NUM(status),
- INT2NUM(r.ru_utime.tv_sec + (r.ru_utime.tv_usec/1000.0)),
- INT2NUM(r.ru_stime.tv_sec + (r.ru_stime.tv_usec/1000.0)),
- INT2NUM(r.ru_maxrss),
- INT2NUM(r.ru_ixrss),
- INT2NUM(r.ru_idrss),
- INT2NUM(r.ru_isrss),
- INT2NUM(r.ru_minflt),
- INT2NUM(r.ru_majflt),
- INT2NUM(r.ru_nswap),
- INT2NUM(r.ru_inblock),
- INT2NUM(r.ru_oublock),
- INT2NUM(r.ru_msgsnd),
- INT2NUM(r.ru_msgrcv),
- INT2NUM(r.ru_nsignals),
- INT2NUM(r.ru_nvcsw),
- INT2NUM(r.ru_nivcsw)
- );
- }
- else{
- return rb_last_status = Qnil;
- }
-}
-
static VALUE
proc_waitall()
{
@@ -2436,10 +2337,8 @@
rb_define_module_function(rb_mProcess, "kill", rb_f_kill, -1);
rb_define_module_function(rb_mProcess, "wait", proc_wait, -1);
rb_define_module_function(rb_mProcess, "wait2", proc_wait2, -1);
- rb_define_module_function(rb_mProcess, "wait3", proc_wait3, -1);
rb_define_module_function(rb_mProcess, "waitpid", proc_wait, -1);
rb_define_module_function(rb_mProcess, "waitpid2", proc_wait2, -1);
- rb_define_module_function(rb_mProcess, "waitpid3", proc_waitpid3,
-1);
rb_define_module_function(rb_mProcess, "waitall", proc_waitall, 0);
rb_define_module_function(rb_mProcess, "detach", proc_detach, 1);