Re: [PATCH 10/19] Introduce reds_core_timer_*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> From: Christophe Fergeau <cfergeau@xxxxxxxxxx>
> 
> ---
>  server/reds.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>  server/reds.h | 11 +++++++++++
>  2 files changed, 54 insertions(+)
> 
> diff --git a/server/reds.c b/server/reds.c
> index 7006420..51092eb 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -4084,6 +4084,49 @@ void reds_core_watch_remove(RedsState *reds,
> SpiceWatch *watch)
>     reds->core->watch_remove(watch);
>  }
>  
> +SpiceTimer *reds_core_timer_add(RedsState *reds,
> +                                SpiceTimerFunc func,
> +                                void *opaque)
> +{
> +   g_return_val_if_fail(reds != NULL, NULL);
> +   g_return_val_if_fail(reds->core != NULL, NULL);
> +   g_return_val_if_fail(reds->core->timer_add != NULL, NULL);
> +
> +   return reds->core->timer_add(reds->core, func, opaque);
> +
> +}
> +
> +void reds_core_timer_start(RedsState *reds,
> +                           SpiceTimer *timer,
> +                           uint32_t ms)
> +{
> +   g_return_if_fail(reds != NULL);
> +   g_return_if_fail(reds->core != NULL);
> +   g_return_if_fail(reds->core->timer_start != NULL);
> +
> +   return reds->core->timer_start(timer, ms);
> +}
> +
> +void reds_core_timer_cancel(RedsState *reds,
> +                            SpiceTimer *timer)
> +{
> +   g_return_if_fail(reds != NULL);
> +   g_return_if_fail(reds->core != NULL);
> +   g_return_if_fail(reds->core->timer_cancel != NULL);
> +
> +   return reds->core->timer_cancel(timer);
> +}
> +
> +void reds_core_timer_remove(RedsState *reds,
> +                            SpiceTimer *timer)
> +{
> +   g_return_if_fail(reds != NULL);
> +   g_return_if_fail(reds->core != NULL);
> +   g_return_if_fail(reds->core->timer_remove != NULL);
> +
> +   return reds->core->timer_remove(timer);
> +}
> +
>  void reds_update_client_mouse_allowed(RedsState *reds)
>  {
>      static int allowed = FALSE;
> diff --git a/server/reds.h b/server/reds.h
> index 6dd0c81..174f48a 100644
> --- a/server/reds.h
> +++ b/server/reds.h
> @@ -127,4 +127,15 @@ void reds_core_watch_update_mask(RedsState *reds,
>                                   int event_mask);
>  void reds_core_watch_remove(RedsState *reds, SpiceWatch *watch);
>  
> +SpiceTimer *reds_core_timer_add(RedsState *reds,
> +                                SpiceTimerFunc func,
> +                                void *opaque);

I think would be really lovely if compiler could detect that
there is a mismatch between the opaque pointer and the
pointer the func function is expecting (I know how to do
this in C++, not really sure about C...).

> +void reds_core_timer_start(RedsState *reds,
> +                           SpiceTimer *timer,
> +                           uint32_t ms);
> +void reds_core_timer_cancel(RedsState *reds,
> +                            SpiceTimer *timer);
> +void reds_core_timer_remove(RedsState *reds,
> +                            SpiceTimer *timer);
> +
>  #endif

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]