Re: [PATCH spice-server 09/16] tests: Allow to quit the message loop

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

 



Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

On Mon, Sep 04, 2017 at 11:57:17AM +0100, Frediano Ziglio wrote:
> This allows to end the loop to end some tests.
> Currently different tests enter the loop but never exit from
> them.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  server/tests/basic-event-loop.c | 11 ++++++++++-
>  server/tests/basic-event-loop.h |  1 +
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/server/tests/basic-event-loop.c b/server/tests/basic-event-loop.c
> index 4cc797bf..46cf3877 100644
> --- a/server/tests/basic-event-loop.c
> +++ b/server/tests/basic-event-loop.c
> @@ -38,6 +38,7 @@ int debug = 0;
>  
>  static SpiceCoreInterfaceInternal base_core_interface;
>  static GMainContext *main_context = NULL;
> +static GMainLoop *loop = NULL;
>  
>  GMainContext *basic_event_loop_get_context(void)
>  {
> @@ -52,10 +53,18 @@ static void event_loop_channel_event(int event, SpiceChannelEventInfo *info)
>  
>  void basic_event_loop_mainloop(void)
>  {
> -    GMainLoop *loop = g_main_loop_new(main_context, FALSE);
> +    loop = g_main_loop_new(main_context, FALSE);
>  
>      g_main_loop_run(loop);
>      g_main_loop_unref(loop);
> +    loop = NULL;
> +}
> +
> +void basic_event_loop_quit(void)
> +{
> +    if (loop) {
> +        g_main_loop_quit(loop);
> +    }
>  }
>  
>  static void ignore_sigpipe(void)
> diff --git a/server/tests/basic-event-loop.h b/server/tests/basic-event-loop.h
> index 593532b6..097f4433 100644
> --- a/server/tests/basic-event-loop.h
> +++ b/server/tests/basic-event-loop.h
> @@ -25,5 +25,6 @@ GMainContext *basic_event_loop_get_context(void);
>  SpiceCoreInterface *basic_event_loop_init(void);
>  void basic_event_loop_destroy(void);
>  void basic_event_loop_mainloop(void);
> +void basic_event_loop_quit(void);
>  
>  #endif // __BASIC_EVENT_LOOP_H__
> -- 
> 2.13.5
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
_______________________________________________
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]