[Spice-devel] [PATCH] worker: use core interface to create watch

Christophe Fergeau cfergeau at redhat.com
Tue Jan 26 04:31:38 PST 2016


On Tue, Jan 26, 2016 at 12:11:55PM +0000, Frediano Ziglio wrote:
> This increase code reuse and make Glib integration more straight forward.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/red-worker.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/server/red-worker.c b/server/red-worker.c
> index a5822a4..05e21f0 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -69,6 +69,7 @@ struct RedWorker {
>      pthread_t thread;
>      QXLInstance *qxl;
>      RedDispatcher *red_dispatcher;
> +    SpiceWatch *dispatch_watch;
>      int running;
>      SpiceCoreInterfaceInternal core;
>      struct pollfd poll_fds[MAX_EVENT_SOURCES];
> @@ -1544,11 +1545,10 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
>          worker->poll_fds[i].fd = -1;
>      }
>  
> -    worker->poll_fds[0].fd = dispatcher_get_recv_fd(dispatcher);
> -    worker->poll_fds[0].events = POLLIN;
> -    worker->watches[0].worker = worker;
> -    worker->watches[0].watch_func = handle_dev_input;
> -    worker->watches[0].watch_func_opaque = worker;
> +    worker->dispatch_watch =
> +        worker->core.watch_add(&worker->core, dispatcher_get_recv_fd(dispatcher),
> +                               SPICE_WATCH_EVENT_READ, handle_dev_input, worker);
> +    spice_assert(worker->dispatch_watch != NULL);

ACK, I was surprised this was done by hand, but did not look if it was
possible to remove this, thanks for investigating that!

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20160126/c10a0780/attachment.sig>


More information about the Spice-devel mailing list