mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Add a trivial race-fix from Chromium: do not try to re-detect whether we have a monotonic clock every time we make a new event_base.
svn:r1427
This commit is contained in:
parent
3b461a6d03
commit
e3f89fa275
@ -18,6 +18,8 @@ Changes in 2.0.3-alpha:
|
|||||||
o New functions to explicitly reference a socket used by an evhttp object. Patches from David Reiss.
|
o New functions to explicitly reference a socket used by an evhttp object. Patches from David Reiss.
|
||||||
o When we send a BEV_EVENT_CONNECTED to indicate connected status, we no longer invoke the write callback as well unless we actually wrote data too.
|
o When we send a BEV_EVENT_CONNECTED to indicate connected status, we no longer invoke the write callback as well unless we actually wrote data too.
|
||||||
o If the kernel tells us that there are a negative number of bytes to read from a socket, do not believe it. Fixes bug 2841177; found by Alexander Pronchenkov.
|
o If the kernel tells us that there are a negative number of bytes to read from a socket, do not believe it. Fixes bug 2841177; found by Alexander Pronchenkov.
|
||||||
|
o Do not detect whether we have monotonic clock support every time a new event base is created: instead do it only once. Patch taken from Chromium.
|
||||||
|
|
||||||
|
|
||||||
Changes in 2.0.2-alpha:
|
Changes in 2.0.2-alpha:
|
||||||
o Add a new flag to bufferevents to make all callbacks automatically deferred.
|
o Add a new flag to bufferevents to make all callbacks automatically deferred.
|
||||||
|
6
event.c
6
event.c
@ -151,9 +151,15 @@ detect_monotonic(void)
|
|||||||
{
|
{
|
||||||
#if defined(_EVENT_HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
|
#if defined(_EVENT_HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
static int use_monotonic_initialized = 0;
|
||||||
|
|
||||||
|
if (use_monotonic_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
|
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
|
||||||
use_monotonic = 1;
|
use_monotonic = 1;
|
||||||
|
|
||||||
|
use_monotonic_initialized = 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user