On Mon, Jan 27, 2014 at 03:15:47PM +0000, Daniel P. Berrange wrote:
> 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 <stefa...@redhat.com>
> > ---
> >  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) 
> 
> ?

I'll do a follow-up patch to pull together all the glib version
abstraction hacks we have in QEMU.

Stefan

Reply via email to