From: Eric Wong <normalperson@yhbt.net>
To: sleepy.penguin@librelist.org
Subject: [sleepy.penguin] [PATCH 2/4] kqueue: remove timeout handling for nevents==0
Date: Fri, 3 May 2013 01:20:04 +0000 [thread overview]
Message-ID: <1367544006-11148-2-git-send-email-normalperson@yhbt.net> (raw)
In-Reply-To: 1367544006-11148-1-git-send-email-normalperson@yhbt.net
The underlying kevent() itself already bypasses the timeout
if nevents==0 (so it is impossible to emulate a sleep function
with kevent()).
---
ext/sleepy_penguin/kqueue.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/ext/sleepy_penguin/kqueue.c b/ext/sleepy_penguin/kqueue.c
index e7d1deb..59c3dae 100644
--- a/ext/sleepy_penguin/kqueue.c
+++ b/ext/sleepy_penguin/kqueue.c
@@ -365,14 +365,13 @@ static VALUE sp_kevent(int argc, VALUE *argv, VALUE self)
rb_raise(rb_eArgError,
"block given but nevents not specified");
nevents = NUM2INT(events);
- if (nevents <= 0)
- rb_raise(rb_eArgError, "nevents must be positive");
+ if (nevents < 0)
+ rb_raise(rb_eArgError, "nevents must be non-negative");
} else {
if (!NIL_P(events))
rb_raise(rb_eArgError,
"nevents specified but block not given");
nevents = 0;
- timeout = INT2FIX(0);
}
kpt = kpt_get(self, nchanges, nevents);
--
1.8.2.1.367.gc875ca7
next prev parent reply other threads:[~2013-05-03 1:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-03 1:20 [sleepy.penguin] [PATCH 1/4] doc: flesh out kqueue-related documentation Eric Wong
2013-05-03 1:20 ` Eric Wong [this message]
2013-05-03 1:20 ` [sleepy.penguin] [PATCH 3/4] test_kqueue_io: additional test for IO-likeness Eric Wong
2013-05-03 1:20 ` [sleepy.penguin] [PATCH 4/4] README: update with latest features Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/sleepy_penguin/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1367544006-11148-2-git-send-email-normalperson@yhbt.net \
--to=normalperson@yhbt.net \
--cc=sleepy.penguin@librelist.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/sleepy_penguin.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).