Skip to content

Instantly share code, notes, and snippets.

@jakedouglas
Created January 20, 2010 22:15
Show Gist options
  • Save jakedouglas/282344 to your computer and use it in GitHub Desktop.
Save jakedouglas/282344 to your computer and use it in GitHub Desktop.
diff --git a/ext/em.cpp b/ext/em.cpp
index e4ee9be..69a70d2 100644
--- a/ext/em.cpp
+++ b/ext/em.cpp
@@ -928,6 +928,17 @@ bool EventMachine_t::_RunSelectOnce()
_ReadLoopBreaker();
}
else if (s < 0) {
+ switch (errno) {
+ case EAGAIN: {
+ rb_sys_fail("The kernel was (perhaps temporarily) unable to allocate the requested number of file descriptors.");
+ }
+ case EBADF: {
+ rb_sys_fail("One of the descriptor sets specified an invalid descriptor.");
+ }
+ case EINVAL: {
+ rb_sys_fail("Somehow EM passed an invalid nfds or invalid timeout to select(2), please report this!");
+ }
+ }
// select can fail on error in a handful of ways.
// If this happens, then wait for a little while to avoid busy-looping.
// If the error was EINTR, we probably caught SIGCHLD or something,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment