[Spice-devel] [PATCH spice 07/11] server/red_worker: assign timer callbacks to worker_core, using spice_timer_queue
Christophe Fergeau
cfergeau at redhat.com
Tue Apr 10 04:45:02 PDT 2012
I'd move this right after the 5th patch, ACK otherwise
On Sun, Apr 08, 2012 at 06:43:16PM +0300, Yonit Halperin wrote:
> display channel: Supplying timeouts interface to red_channel, in order to allow
> periodic network monitoring.
>
> Signed-off-by: Yonit Halperin <yhalperi at redhat.com>
> ---
> server/red_worker.c | 14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 9fa3afd..eec4beb 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -78,6 +78,7 @@
> #include "red_dispatcher.h"
> #include "dispatcher.h"
> #include "main_channel.h"
> +#include "spice_timer_queue.h"
>
> //#define COMPRESS_STAT
> //#define DUMP_BITMAP
> @@ -9704,6 +9705,11 @@ static void worker_watch_remove(SpiceWatch *watch)
> }
>
> SpiceCoreInterface worker_core = {
> + .timer_add = spice_timer_queue_add,
> + .timer_start = spice_timer_set,
> + .timer_cancel = spice_timer_cancel,
> + .timer_remove = spice_timer_remove,
> +
> .watch_update_mask = worker_watch_update_mask,
> .watch_add = worker_watch_add,
> .watch_remove = worker_watch_remove,
> @@ -11224,6 +11230,10 @@ static void red_init(RedWorker *worker, WorkerInitData *init_data)
> spice_warn_if(init_data->n_surfaces > NUM_SURFACES);
> worker->n_surfaces = init_data->n_surfaces;
>
> + if (!spice_timer_queue_create()) {
> + spice_error("failed to create timer queue");
> + }
> +
> message = RED_WORKER_MESSAGE_READY;
> write_message(worker->channel, &message);
> }
> @@ -11257,10 +11267,14 @@ void *red_worker_main(void *arg)
> worker.event_timeout = INF_EVENT_WAIT;
> for (;;) {
> int i, num_events;
> + unsigned int timers_queue_timeout;
>
> + timers_queue_timeout = spice_timer_queue_get_timeout_ms();
> worker.event_timeout = MIN(red_get_streams_timout(&worker), worker.event_timeout);
> + worker.event_timeout = MIN(timers_queue_timeout, worker.event_timeout);
> num_events = poll(worker.poll_fds, MAX_EVENT_SOURCES, worker.event_timeout);
> red_handle_streams_timout(&worker);
> + spice_timer_queue_cb();
>
> if (worker.display_channel) {
> /* during migration, in the dest, the display channel can be initialized
> --
> 1.7.7.6
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120410/9af1732d/attachment.pgp>
More information about the Spice-devel
mailing list