From d3bf433638fea5fea60da8d2666f8bfd9fc7fa0d Mon Sep 17 00:00:00 2001 From: Marc Alexander Lehmann Date: Wed, 22 Jan 2020 14:09:07 +0000 Subject: [PATCH] *** empty log message *** --- Changes | 2 ++ ev++.h | 2 +- ev.c | 8 ++++++++ ev.pod | 5 +++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index 91dc1fa..548f9d0 100644 --- a/Changes +++ b/Changes @@ -17,6 +17,8 @@ TODO: maybe allow events = 0 for io watchers work with older libev versions as well but was not officially allowed before. - do not wake up every minute when timerfd is used to detect timejumps. + - do not wake up every minute when periodics are disabled and we have + a monotonic clock. - support a lot more "uncommon" compile time configurations, such as ev_embed enabled but ev_timer disabled. - use a start/stop wrapper class to reduce code duplication in diff --git a/ev++.h b/ev++.h index de2ffb8..22dfcf5 100644 --- a/ev++.h +++ b/ev++.h @@ -1,7 +1,7 @@ /* * libev simple C++ wrapper classes * - * Copyright (c) 2007,2008,2010,2018 Marc Alexander Lehmann + * Copyright (c) 2007,2008,2010,2018,2020 Marc Alexander Lehmann * All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- diff --git a/ev.c b/ev.c index 6318b35..d31f6b5 100644 --- a/ev.c +++ b/ev.c @@ -3045,7 +3045,9 @@ timerfdcb (EV_P_ ev_io *iow, int revents) now_floor = EV_TS_CONST (0.); time_update (EV_A_ EV_TSTAMP_HUGE); */ +#if EV_PERIODIC_ENABLE periodics_reschedule (EV_A); +#endif } ecb_noinline ecb_cold @@ -4097,6 +4099,12 @@ ev_run (EV_P_ int flags) if (ecb_expect_true (timerfd >= 0)) waittime = EV_TS_CONST (MAX_BLOCKTIME2); #endif +#if !EV_PERIODIC_ENABLE + /* without periodics but with monotonic clock there is no need */ + /* for any time jump detection, so sleep longer */ + if (ecb_expect_true (have_monotonic)) + waittime = EV_TS_CONST (MAX_BLOCKTIME2); +#endif if (timercnt) { diff --git a/ev.pod b/ev.pod index b351cec..08b46b0 100644 --- a/ev.pod +++ b/ev.pod @@ -1655,8 +1655,9 @@ Most members are additionally marked with either I<[read-only]>, meaning that, while the watcher is active, you can look at the member and expect some sensible content, but you must not modify it (you can modify it while the watcher is stopped to your hearts content), or I<[read-write]>, which -means you can expect it to have some sensible content while the watcher -is active, but you can also modify it. Modifying it may not do something +means you can expect it to have some sensible content while the watcher is +active, but you can also modify it (within the same thread as the event +loop, i.e. without creating data races). Modifying it may not do something sensible or take immediate effect (or do anything at all), but libev will not crash or malfunction in any way.