utils: Introduce xsleep for RCU quiescent state
authorPravin <pshelar@nicira.com>
Fri, 21 Mar 2014 16:20:42 +0000 (09:20 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Fri, 21 Mar 2014 18:48:28 +0000 (11:48 -0700)
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/daemon.c
lib/util.c
lib/util.h

index 9d96cba..c1c6550 100644 (file)
@@ -416,7 +416,7 @@ monitor_daemon(pid_t daemon_pid)
                         if (now >= wakeup) {
                             break;
                         }
-                        sleep(wakeup - now);
+                        xsleep(wakeup - now);
                     }
                 }
                 last_restart = time(NULL);
index 0d1d9a5..805f33a 100644 (file)
@@ -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
 \f
 char *
index 3db005a..13ff58e 100644 (file)
@@ -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
 }