diff options
author | root <root> | 2009-01-06 19:46:56 +0000 |
---|---|---|
committer | root <root> | 2009-01-06 19:46:56 +0000 |
commit | ff4968a12811c47cdda59e91c9c5b1d4355800ab (patch) | |
tree | 3f76d5a6956009ed7488a50060450c7103a4061d /ev_select.c | |
parent | 3a75abe4102c7f57b275b3a0febe1ebc6d05bd62 (diff) |
*** empty log message ***
Diffstat (limited to 'ev_select.c')
-rw-r--r-- | ev_select.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ev_select.c b/ev_select.c index 1835444..5a5a61d 100644 --- a/ev_select.c +++ b/ev_select.c @@ -1,7 +1,7 @@ /* * libev select fd activity backend * - * Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de> + * Copyright (c) 2007,2008,2009 Marc Alexander Lehmann <libev@schmorp.de> * All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- @@ -72,6 +72,7 @@ select_modify (EV_P_ int fd, int oev, int nev) { #if EV_SELECT_USE_FD_SET + assert (("libev: fd >= FD_SETSIZE passed to fd_set-based select backend", fd < FD_SETSIZE)); #if EV_SELECT_IS_WINSOCKET SOCKET handle = anfds [fd].handle; @@ -158,6 +159,9 @@ select_poll (EV_P_ ev_tstamp timeout) */ memcpy (vec_eo, vec_wi, fd_setsize); res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, (fd_set *)vec_eo, &tv); +#elif EV_SELECT_USE_FD_SET + fd_setsize = anfdmax < FD_SETSIZE ? anfdmax : FD_SETSIZE; + res = select (fd_setsize, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv); #else res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv); #endif @@ -265,7 +269,6 @@ select_init (EV_P_ int flags) backend_poll = select_poll; #if EV_SELECT_USE_FD_SET - vec_max = FD_SETSIZE / 32; vec_ri = ev_malloc (sizeof (fd_set)); FD_ZERO ((fd_set *)vec_ri); vec_ro = ev_malloc (sizeof (fd_set)); vec_wi = ev_malloc (sizeof (fd_set)); FD_ZERO ((fd_set *)vec_wi); |