qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Anthony Liguori <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [PULL 3/4] trace: add glib 2.32+ static GMutex support
Date: Tue, 28 Jan 2014 13:01:08 +0100	[thread overview]
Message-ID: <20140128120108.GD16709@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <20140127151547.GK29958@redhat.com>

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 <stefanha@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	other threads:[~2014-01-28 12:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 14:53 [Qemu-devel] [PULL 0/4] Tracing patches Stefan Hajnoczi
2014-01-27 14:53 ` [Qemu-devel] [PULL 1/4] tracing: start trace processing thread in final child process Stefan Hajnoczi
2014-01-27 19:25   ` Eric Blake
2014-01-27 14:53 ` [Qemu-devel] [PULL 2/4] trace: [simple] Do not include "trace/simple.h" in generated tracer headers Stefan Hajnoczi
2014-01-27 14:53 ` [Qemu-devel] [PULL 3/4] trace: add glib 2.32+ static GMutex support Stefan Hajnoczi
2014-01-27 15:15   ` Daniel P. Berrange
2014-01-28 12:01     ` Stefan Hajnoczi [this message]
2014-01-27 14:53 ` [Qemu-devel] [PULL 4/4] trace: fix simple trace "disable" keyword Stefan Hajnoczi
2014-01-31 11:22 ` [Qemu-devel] [PULL 0/4] Tracing patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140128120108.GD16709@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=aliguori@amazon.com \
    --cc=berrange@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).