# It seems that rb\_thread\_wait\_fd() doesn't work in 1.8.6

**URL:** <https://www.ruby-forum.com/t/it-seems-that-rb-thread-wait-fd-doesnt-work-in-1-8-6/132078>\
**Category:** Ruby\
**Created:** [March 16, 2008, 3:40pm UTC](https://www.ruby-forum.com/t/it-seems-that-rb-thread-wait-fd-doesnt-work-in-1-8-6/132078 "2008-03-16T15:40:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 16, 2008, 3:40pm UTC](https://www.ruby-forum.com/t/it-seems-that-rb-thread-wait-fd-doesnt-work-in-1-8-6/132078/1 "2008-03-16T15:40:41Z")

</div>

Here is a test:  
[http://s3.amazonaws.com/four.livejournal/20080316/rb\_thread\_wait\_fd.tar.gz](http://s3.amazonaws.com/four.livejournal/20080316/rb_thread_wait_fd.tar.gz)

compile it: ruby extconf.rb && make  
run it: ruby test.rb

it should not exit.

Ruby 1.9.0 has the correct behavior, but 1.8.6 exits immediately.

Is this a bug? Probably not - what am I doing wrong?

thanks, ry

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 16, 2008, 4:52pm UTC](https://www.ruby-forum.com/t/it-seems-that-rb-thread-wait-fd-doesnt-work-in-1-8-6/132078/2 "2008-03-16T16:52:36Z")

</div>

> > > > > “r” == ry [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

r\> it should not exit.

Why ?

vgs% cat a.c  
#include \<stdio.h\>  
#include \<sys/select.h\>  
#include \<sys/socket.h\>  
#include \<sys/types.h\>  
#include \<assert.h\>

int main()  
{  
fd\_set readfds;  
int fd = socket(AF\_INET, SOCK\_STREAM, 0);  
assert(fd \> 0);  
FD\_ZERO(&readfds);  
FD\_SET(fd, &readfds);  
select(fd + 1, &readfds, 0, 0, NULL);  
return 0;  
}  
vgs%

vgs% ./a.out  
vgs%

r\> Ruby 1.9.0 has the correct behavior

what is your version of ruby ?

vgs% ruby -v test.rb  
ruby 1.9.0 (2008-03-16 revision 15786) [i686-linux]  
starting test  
entering rb\_thread\_wait\_fd  
leaving rb\_thread\_wait\_fd  
vgs%

Guy Decoux

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 17, 2008, 9:52am UTC](https://www.ruby-forum.com/t/it-seems-that-rb-thread-wait-fd-doesnt-work-in-1-8-6/132078/3 "2008-03-17T09:52:32Z")

</div>

Hi,

At Sun, 16 Mar 2008 23:40:00 +0900,  
ry wrote in [ruby-talk:294753]:

> Is this a bug? Probably not - what am I doing wrong?

It doesn’t block at EOF.
