Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1092)

Side by Side Diff: third_party/libevent/chromium.patch

Issue 231493002: libevent: fix race in the common case. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/libevent/README.chromium ('k') | third_party/libevent/event.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 diff --git a/third_party/libevent/evdns.c b/third_party/libevent/evdns.c 1 diff --git a/third_party/libevent/evdns.c b/third_party/libevent/evdns.c
2 index f07ecc9..da6ea19 100644 2 index f07ecc9..da6ea19 100644
3 --- a/third_party/libevent/evdns.c 3 --- a/third_party/libevent/evdns.c
4 +++ b/third_party/libevent/evdns.c 4 +++ b/third_party/libevent/evdns.c
5 @@ -134,7 +134,7 @@ 5 @@ -134,7 +134,7 @@
6 typedef ev_uint8_t u_char; 6 typedef ev_uint8_t u_char;
7 typedef unsigned int uint; 7 typedef unsigned int uint;
8 #endif 8 #endif
9 -#include <event.h> 9 -#include <event.h>
10 +#include "event.h" 10 +#include "event.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 +++ b/third_party/libevent/evutil.h 74 +++ b/third_party/libevent/evutil.h
75 @@ -38,7 +38,7 @@ 75 @@ -38,7 +38,7 @@
76 extern "C" { 76 extern "C" {
77 #endif 77 #endif
78 78
79 -#include <event-config.h> 79 -#include <event-config.h>
80 +#include "event-config.h" 80 +#include "event-config.h"
81 #ifdef _EVENT_HAVE_SYS_TIME_H 81 #ifdef _EVENT_HAVE_SYS_TIME_H
82 #include <sys/time.h> 82 #include <sys/time.h>
83 #endif 83 #endif
84 diff --git a/third_party/libevent/README.chromium b/third_party/libevent/README. chromium
85 index 9969566..7e5f8ba 100644
86 diff --git a/third_party/libevent/event.c b/third_party/libevent/event.c
87 index 1253352..8b6cae5 100644
88 --- a/third_party/libevent/event.c
89 +++ b/third_party/libevent/event.c
90 @@ -107,7 +107,7 @@ static const struct eventop *eventops[] = {
91 /* Global state */
92 struct event_base *current_base = NULL;
93 extern struct event_base *evsignal_base;
94 -static int use_monotonic;
95 +static int use_monotonic = 1;
96
97 /* Prototypes */
98 static void event_queue_insert(struct event_base *, struct event *, int);
99 @@ -120,17 +120,6 @@ static int timeout_next(struct event_base *, struct timeval **);
100 static void timeout_process(struct event_base *);
101 static void timeout_correct(struct event_base *, struct timeval *);
102
103 -static void
104 -detect_monotonic(void)
105 -{
106 -#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
107 - struct timespec ts;
108 -
109 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
110 - use_monotonic = 1;
111 -#endif
112 -}
113 -
114 static int
115 gettime(struct event_base *base, struct timeval *tp)
116 {
117 @@ -140,18 +129,18 @@ gettime(struct event_base *base, struct timeval *tp)
118 }
119
120 #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
121 - if (use_monotonic) {
122 - struct timespec ts;
123 -
124 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
125 - return (-1);
126 + struct timespec ts;
127
128 + if (use_monotonic &&
129 + clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
130 tp->tv_sec = ts.tv_sec;
131 tp->tv_usec = ts.tv_nsec / 1000;
132 return (0);
133 }
134 #endif
135
136 + use_monotonic = 0;
137 +
138 return (evutil_gettimeofday(tp, NULL));
139 }
140
141 @@ -175,7 +164,6 @@ event_base_new(void)
142 if ((base = calloc(1, sizeof(struct event_base))) == NULL)
143 event_err(1, "%s: calloc", __func__);
144
145 - detect_monotonic();
146 gettime(base, &base->event_tv);
147
148 min_heap_ctor(&base->timeheap);
OLDNEW
« no previous file with comments | « third_party/libevent/README.chromium ('k') | third_party/libevent/event.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698