diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-01-08 11:30:49 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-01-08 11:30:49 -0800 |
commit | 531106e51e519458d37bed3721da4eff2f163206 (patch) | |
tree | 099b2b225dd646c0b8bfb24175fef7773e924a30 /ext/posix_mq/posix_mq.c | |
parent | d03c76ae11ca6294e05262df747e4d43822ada73 (diff) | |
download | ruby_posix_mq-531106e51e519458d37bed3721da4eff2f163206.tar.gz |
It's not needed since the native thread will retry in the unlikely case of EINTR/EAGAIN. And writing one byte to a pipe that's guaranteed by POSIX to be at least 512 bytes is highly unlikely. It's also bad because F_SETFL takes the big kernel lock under Linux (and possibly other systems), and doing it unnecessarily is a waste of system cycles.
Diffstat (limited to 'ext/posix_mq/posix_mq.c')
-rw-r--r-- | ext/posix_mq/posix_mq.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/ext/posix_mq/posix_mq.c b/ext/posix_mq/posix_mq.c index 3972620..6480645 100644 --- a/ext/posix_mq/posix_mq.c +++ b/ext/posix_mq/posix_mq.c @@ -730,23 +730,9 @@ static void setup_notify_io(struct sigevent *not, VALUE io) { VALUE fileno = rb_funcall(io, id_fileno, 0, 0); int fd = NUM2INT(fileno); - int flags; pthread_attr_t attr; int e; - /* - * fd going to be written to inside a native thread, - * make it blocking for simplicity - */ - flags = fcntl(fd, F_GETFL); - if (flags < 0) { - rb_sys_fail("fcntl F_GETFL"); - } else if (flags & O_NONBLOCK) { - flags = fcntl(fd, F_SETFL, flags & ~O_NONBLOCK); - if (flags < 0) - rb_sys_fail("fcntl F_SETFL"); - } - if ((e = pthread_attr_init(&attr))) goto err; if ((e = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED))) |