qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PULL 3/4] trace: add glib 2.32+ static GMutex support


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PULL 3/4] trace: add glib 2.32+ static GMutex support
Date: Mon, 27 Jan 2014 15:15:47 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Jan 27, 2014 at 03:53:05PM +0100, Stefan Hajnoczi wrote:
> The GStaticMutex API was deprecated in glib 2.32.  We cannot switch over
> to GMutex unconditionally since we would drop support for older glib
> versions.  But the deprecated API warnings during build are annoying so
> use static GMutex when possible.
> 
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
>  trace/simple.c | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/trace/simple.c b/trace/simple.c
> index 410172e..57572c4 100644
> --- a/trace/simple.c
> +++ b/trace/simple.c
> @@ -40,7 +40,17 @@
>   * Trace records are written out by a dedicated thread.  The thread waits for
>   * records to become available, writes them out, and then waits again.
>   */
> +#if GLIB_CHECK_VERSION(2, 32, 0)
> +static GMutex trace_lock;
> +#define lock_trace_lock() g_mutex_lock(&trace_lock)
> +#define unlock_trace_lock() g_mutex_unlock(&trace_lock)
> +#define get_trace_lock_mutex() (&trace_lock)
> +#else
>  static GStaticMutex trace_lock = G_STATIC_MUTEX_INIT;
> +#define lock_trace_lock() g_static_mutex_lock(&trace_lock)
> +#define unlock_trace_lock() g_static_mutex_unlock(&trace_lock)
> +#define get_trace_lock_mutex() g_static_mutex_get_mutex(&trace_lock)
> +#endif

coroutine-gthread.c also uses GStaticMutex - is there somewhere you
could put some compat calls tobe shared. Perhaps some hack like

  #define GStaticMutex GMutex
  #define g_static_mutex_lock(m) g_mutex_lock(m) 

?

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]