summaryrefslogtreecommitdiffstats
path: root/src/os_time.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/os_time.h')
-rwxr-xr-xsrc/os_time.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/os_time.h b/src/os_time.h
index b1d44c03..4f10e2b5 100755
--- a/src/os_time.h
+++ b/src/os_time.h
@@ -165,6 +165,17 @@ void delay(int msec){
nanosleep(&time1,&remain);
}
-
+/**
+ * more accurate sleep by doing spin
+ *
+ */
+static inline
+void delay_spin(double sec) {
+ double target = now_sec() + sec;
+
+ while (now_sec() < target) {
+ rte_pause();
+ }
+}
#endif