From: Joe Van Dyk Date: 2005-06-25T13:33:17+09:00 Subject: Re: speeding up Process.detach frequency On 6/24/05, nobu.nokada@softhome.net wrote: > Hi, > > At Sat, 25 Jun 2005 11:42:03 +0900, > Joe Van Dyk wrote in [ruby-talk:146425]: > > Is there any way to speed up Process.detach? The ri documentation for > > it says that it checks once a second, and I'd like to up that to maybe > > once every quarter second. > > It seems like a bug of Process.detach. After it received the > termination, it unnecessarily waits for one second again. > > > Index: process.c > =================================================================== > RCS file: /cvs/ruby/src/ruby/process.c,v > retrieving revision 1.131 > diff -U2 -p -r1.131 process.c > --- process.c 16 May 2005 13:42:59 -0000 1.131 > +++ process.c 25 Jun 2005 04:04:39 -0000 > @@ -850,9 +850,7 @@ detach_process_watcher(pid_p) > int cpid, status; > > - for (;;) { > - cpid = rb_waitpid(*pid_p, &status, WNOHANG); > - if (cpid == -1) return rb_last_status; > - rb_thread_sleep(1); > - } > + cpid = rb_waitpid(*pid_p, &status, 0); > + if (cpid == -1) return Qnil; > + return rb_last_status; > } Hm, that might work. I'll have to try it on Monday. Thanks, Joe