diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/daemon.c | 2 | ||||
-rw-r--r-- | lib/util.c | 12 | ||||
-rw-r--r-- | lib/util.h | 1 |
3 files changed, 14 insertions, 1 deletions
diff --git a/lib/daemon.c b/lib/daemon.c index 9d96cba8b..c1c6550a9 100644 --- a/lib/daemon.c +++ b/lib/daemon.c @@ -416,7 +416,7 @@ monitor_daemon(pid_t daemon_pid) if (now >= wakeup) { break; } - sleep(wakeup - now); + xsleep(wakeup - now); } } last_restart = time(NULL); diff --git a/lib/util.c b/lib/util.c index 0d1d9a52b..805f33a8c 100644 --- a/lib/util.c +++ b/lib/util.c @@ -30,6 +30,7 @@ #include "bitmap.h" #include "byte-order.h" #include "coverage.h" +#include "ovs-rcu.h" #include "ovs-thread.h" #include "vlog.h" #ifdef HAVE_PTHREAD_SET_NAME_NP @@ -1726,6 +1727,17 @@ exit: return ok; } +unsigned int +xsleep(unsigned int seconds) +{ + unsigned int t; + + ovsrcu_quiesce_start(); + t = sleep(seconds); + ovsrcu_quiesce_end(); + return t; +} + #ifdef _WIN32 char * diff --git a/lib/util.h b/lib/util.h index 3db005aae..13ff58ece 100644 --- a/lib/util.h +++ b/lib/util.h @@ -507,6 +507,7 @@ char *ovs_format_message(int error); char *ovs_lasterror_to_string(void); int ftruncate(int fd, off_t length); #endif +unsigned int xsleep(unsigned int seconds); #ifdef __cplusplus } |