From: Tanaka Akira Date: 2006-05-09T12:55:39+09:00 Subject: Re: Considering Ruby For a Networking Application In article <021f01c67317$905a5900$6442a8c0@musicbox>, "Bill Kelly" writes: > Wow. Thanks for the details! I'm going to have to eat my > words on a couple recent posts where I thought ruby behaved > identically regardless of whether just one thread or multiple > threads existed. As far as I know, matz found the inconsistency in [ruby-talk:66196]. It is not intended. > Out of curiosity, is there a technical reason why it's > desirable for #sysread to raise EAGAIN in this one situation? 1. In general, matz respect programmer's knowledge on POSIX. For example, "read(2) system call cause EAGAIN on non-blocking mode" in this case. I don't think many programmers understand the non-blocking issue well, though. 2. Some application, maybe event driven system, needs EAGAIN. (If no application needs EAGAIN, why POSIX has EAGAIN?) However checking O_NONBLOCK before read(2) have race condition if the fd is shared with another process. So I recommend other solution if possible. -- Tanaka Akira