From: Laurent Sansonetti Date: 2003-05-16T16:48:18+09:00 Subject: Re: PTY: still problems (+patch) Hi Nobu, nobu.nokada@softhome.net wrote: > I noticed a bit different problem on Linux, EIO occurs. > I can test the code on Linux, and help you to fix this problem. The most difficult part here is to steal my girlfriend's laptop ;-) >>- rb_thread_kill(info->thread); >>+ rb_funcall(info->thread, rb_intern("join"), 0); > > > Here, it might be better to use "value". > You're right, rb_thread_value() is meaningful here. What do you think of the following patch? pinux@natalie ~/ruby> cvs diff -u eval.c intern.h ext/pty/pty.c Index: eval.c =================================================================== RCS file: /src/ruby/eval.c,v retrieving revision 1.430 diff -u -r1.430 eval.c --- eval.c 13 May 2003 05:53:08 -0000 1.430 +++ eval.c 16 May 2003 07:43:23 -0000 @@ -9178,7 +9178,7 @@ return rb_thread_start_0(rb_thread_yield, args, rb_thread_alloc(klass)); } -static VALUE +VALUE rb_thread_value(thread) VALUE thread; { Index: intern.h =================================================================== RCS file: /src/ruby/intern.h,v retrieving revision 1.119 diff -u -r1.119 intern.h --- intern.h 13 May 2003 05:53:08 -0000 1.119 +++ intern.h 16 May 2003 07:43:24 -0000 @@ -212,6 +212,7 @@ VALUE rb_thread_local_aref _((VALUE, ID)); VALUE rb_thread_local_aset _((VALUE, ID, VALUE)); void rb_thread_atfork _((void)); +VALUE rb_thread_value _((VALUE)); /* file.c */ int eaccess _((const char*, int)); VALUE rb_file_s_expand_path _((int, VALUE *)); Index: ext/pty/pty.c =================================================================== RCS file: /src/ruby/ext/pty/pty.c,v retrieving revision 1.15 diff -u -r1.15 pty.c --- ext/pty/pty.c 10 Mar 2003 15:05:18 -0000 1.15 +++ ext/pty/pty.c 16 May 2003 07:43:26 -0000 @@ -299,7 +299,7 @@ pty_finalize_syswait(info) struct pty_info *info; { - rb_thread_kill(info->thread); + rb_thread_value(info->thread); rb_detach_process(info->child_pid); return Qnil; } It works nicely here. > I agree to export it (and rb_thread_value maybe), but could you > explain why 'limit' is needed here? > After some reflection, there is no need to 'limit' the blocking. I was a bit tired yesterday ;-) -- Laurent