diff mbox series

[v3,1/2] tests/test-char.c: Don't use main_loop_wait()'s return value

Message ID 1498584769-12439-2-git-send-email-peter.maydell@linaro.org
State Superseded
Headers show
Series main_loop: Make main_loop_wait() return void | expand

Commit Message

Peter Maydell June 27, 2017, 5:32 p.m. UTC
In QEMU's main_loop() we used to check whether we should do
a nonblocking call to main_loop(); this was deleted in commit e330c118f2a5,
because now that vCPUs always drop the I/O thread lock it is an unnecessary
optimization.

The loop in test-char.c copied the old QEMU main_loop() code, but
here the nonblocking check has never been necessary because this
standalone test case doesn't hold the I/O lock anyway. Remove it,
so we can drop the main_loop_wait() return value.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 tests/test-char.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

-- 
2.7.4

Comments

Marc-André Lureau June 27, 2017, 6:07 p.m. UTC | #1
On Tue, Jun 27, 2017 at 7:57 PM Peter Maydell <peter.maydell@linaro.org>
wrote:

> In QEMU's main_loop() we used to check whether we should do

> a nonblocking call to main_loop(); this was deleted in commit e330c118f2a5,

> because now that vCPUs always drop the I/O thread lock it is an unnecessary

> optimization.

>

> The loop in test-char.c copied the old QEMU main_loop() code, but

> here the nonblocking check has never been necessary because this

> standalone test case doesn't hold the I/O lock anyway. Remove it,

> so we can drop the main_loop_wait() return value.

>

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

>


Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>




> ---

>  tests/test-char.c | 6 +-----

>  1 file changed, 1 insertion(+), 5 deletions(-)

>

> diff --git a/tests/test-char.c b/tests/test-char.c

> index 9e361c8..94ef708 100644

> --- a/tests/test-char.c

> +++ b/tests/test-char.c

> @@ -20,13 +20,9 @@ typedef struct FeHandler {

>

>  static void main_loop(void)

>  {

> -    bool nonblocking;

> -    int last_io = 0;

> -

>      quit = false;

>      do {

> -        nonblocking = last_io > 0;

> -        last_io = main_loop_wait(nonblocking);

> +        main_loop_wait(false);

>      } while (!quit);

>  }

>

> --

> 2.7.4

>

>

> --

Marc-André Lureau
diff mbox series

Patch

diff --git a/tests/test-char.c b/tests/test-char.c
index 9e361c8..94ef708 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -20,13 +20,9 @@  typedef struct FeHandler {
 
 static void main_loop(void)
 {
-    bool nonblocking;
-    int last_io = 0;
-
     quit = false;
     do {
-        nonblocking = last_io > 0;
-        last_io = main_loop_wait(nonblocking);
+        main_loop_wait(false);
     } while (!quit);
 }