[Spice-devel] [PATCH spice-server 1/2] red-qxl: Remove AsyncCommand
Christophe Fergeau
cfergeau at redhat.com
Mon Sep 18 10:10:39 UTC 2017
On Mon, Sep 11, 2017 at 09:08:54AM +0100, Frediano Ziglio wrote:
> This structure was used to store the cookie for the async
> reply and the message for the generic async callback.
> Most async messages do not require extra action beside
> sending back the cookie for the reply so instead of using
> a switch inline the replies and remove store the cookie
> directory instead of a pointer to AsyncCommand.
"instead of having a switch on the message type in
red_qxl_async_complete, this commit moves the message-specific behaviour
to the callers, which allows us to store the cookie directly in RedWorkerMessageAsync
rather than needing an intermediate AsyncCommand structure"
(though I guess we could have exactly the same explanation for moving
both the cookie and the message type to RedWorkerMessageAsync).
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/red-qxl.c | 71 +++++++++++++----------------------------------------
> server/red-qxl.h | 1 +
> server/red-worker.c | 18 ++++++++------
> server/red-worker.h | 5 ++--
> 4 files changed, 31 insertions(+), 64 deletions(-)
>
> Not a regression but this change shows that
> red_qxl_destroy_primary_surface_complete and
> red_qxl_create_primary_surface_complete are called from the worker
> thread. This possibly can be a race condition as they call some
> functions in red-qxl.c and reds.c that possibly use structures that
> should only be used in the main thread.
I would add a comment to the functions that you made public to mention
that they are being called from the worker thread.
Looks good otherwise,
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
Christophe
More information about the Spice-devel
mailing list