[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v9 08/20] multi-process: Initialize message handler in remote
From: |
Elena Ufimtseva |
Subject: |
Re: [PATCH v9 08/20] multi-process: Initialize message handler in remote device |
Date: |
Thu, 24 Sep 2020 10:20:08 -0700 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Wed, Sep 23, 2020 at 03:10:39PM +0100, Stefan Hajnoczi wrote:
> This is the function that can be converted from a callback to a
> coroutine like this:
>
> void coroutine_fn mpqemu_loop(...)
> {
> for (;;) {
> if (mpqemu_msg_read(...) < 0) {
> /* Fatal connection error (disconnected, etc) */
> break;
> }
>
> if (!mpqemu_msg_valid(&msg)) {
> /* Protocol violation, terminate connection */
> break;
> }
>
> switch (msg.cmd) {
> /* Dispatch command */
> }
> }
> }
Ok, thank you! I have something similar.
Elena