ringtest: commonize implementation of poll_avail/poll_used
[cascardo/linux.git] / tools / virtio / ringtest / main.c
index bda7f0d..b00ecd6 100644 (file)
@@ -96,6 +96,12 @@ void set_affinity(const char *arg)
        assert(!ret);
 }
 
+void poll_used(void)
+{
+       while (used_empty())
+               busy_wait();
+}
+
 static void __attribute__((__flatten__)) run_guest(void)
 {
        int completed_before;
@@ -149,6 +155,12 @@ static void __attribute__((__flatten__)) run_guest(void)
        }
 }
 
+void poll_avail(void)
+{
+       while (avail_empty())
+               busy_wait();
+}
+
 static void __attribute__((__flatten__)) run_host(void)
 {
        int completed_before;