This will be used by KA framework that needs millisecond granularity.

Signed-off-by: Bhanuprakash Bodireddy <[email protected]>
---
 lib/util.c | 12 ++++++++++++
 lib/util.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/lib/util.c b/lib/util.c
index 1c06ce0..889ebd8 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -2125,6 +2125,18 @@ xsleep(unsigned int seconds)
     ovsrcu_quiesce_end();
 }
 
+void
+xusleep(unsigned int microseconds)
+{
+    ovsrcu_quiesce_start();
+#ifdef _WIN32
+    Sleep(microseconds/1000);
+#else
+    usleep(microseconds);
+#endif
+    ovsrcu_quiesce_end();
+}
+
 /* Determine whether standard output is a tty or not. This is useful to decide
  * whether to use color output or not when --color option for utilities is set
  * to `auto`.
diff --git a/lib/util.h b/lib/util.h
index aa38122..637d0c3 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -451,6 +451,7 @@ ovs_u128_and(const ovs_u128 a, const ovs_u128 b)
 }
 
 void xsleep(unsigned int seconds);
+void xusleep(unsigned int microseconds);
 
 bool is_stdout_a_tty(void);
 
-- 
2.4.11

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to