diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 20:23:54 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 20:23:54 +0000 |
commit | 78d4429cef4baac9bcdfc2396ce157016621c416 (patch) | |
tree | ca8e34515c63dd682d9b75b9bfc6113fcb0c2dfd /third_party/libevent/select.c | |
parent | 9101b6b1b3de0a1e3c59325055707c58748651af (diff) | |
download | chromium_src-78d4429cef4baac9bcdfc2396ce157016621c416.zip chromium_src-78d4429cef4baac9bcdfc2396ce157016621c416.tar.gz chromium_src-78d4429cef4baac9bcdfc2396ce157016621c416.tar.bz2 |
posix: upgrade libevent from 1.4.7 to 1.4.13
I took this opportunity to rejigger how we hacked around using an uninstalled
libevent, to remove a TODO that mentioned danger in the README.
Files to review: README.chromium and chromium.patch.
The rest are probably rubber-stampable.
Review URL: http://codereview.chromium.org/412006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32656 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/libevent/select.c')
-rw-r--r-- | third_party/libevent/select.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/third_party/libevent/select.c b/third_party/libevent/select.c index 7faafe4..3f73331 100644 --- a/third_party/libevent/select.c +++ b/third_party/libevent/select.c @@ -34,7 +34,7 @@ #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #else -#include <sys/_time.h> +#include <sys/_libevent_time.h> #endif #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> @@ -51,6 +51,7 @@ #endif #include "event.h" +#include "evutil.h" #include "event-internal.h" #include "evsignal.h" #include "log.h" @@ -59,6 +60,13 @@ #define howmany(x, y) (((x)+((y)-1))/(y)) #endif +#ifndef _EVENT_HAVE_FD_MASK +/* This type is mandatory, but Android doesn't define it. */ +#undef NFDBITS +#define NFDBITS (sizeof(long)*8) +typedef unsigned long fd_mask; +#endif + struct selectop { int event_fds; /* Highest fd in fd set */ int event_fdsz; @@ -94,7 +102,7 @@ select_init(struct event_base *base) struct selectop *sop; /* Disable select when this environment variable is set */ - if (getenv("EVENT_NOSELECT")) + if (evutil_getenv("EVENT_NOSELECT")) return (NULL); if (!(sop = calloc(1, sizeof(struct selectop)))) @@ -137,7 +145,7 @@ check_selectop(struct selectop *sop) static int select_dispatch(struct event_base *base, void *arg, struct timeval *tv) { - int res, i; + int res, i, j; struct selectop *sop = arg; check_selectop(sop); @@ -167,8 +175,12 @@ select_dispatch(struct event_base *base, void *arg, struct timeval *tv) event_debug(("%s: select reports %d", __func__, res)); check_selectop(sop); - for (i = 0; i <= sop->event_fds; ++i) { + i = random() % (sop->event_fds+1); + for (j = 0; j <= sop->event_fds; ++j) { struct event *r_ev = NULL, *w_ev = NULL; + if (++i >= sop->event_fds+1) + i = 0; + res = 0; if (FD_ISSET(i, sop->event_readset_out)) { r_ev = sop->event_r_by_fd[i]; |