From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W87M0-0006tm-Ns for qemu-devel@nongnu.org; Tue, 28 Jan 2014 07:01:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W87Ls-0004yl-AN for qemu-devel@nongnu.org; Tue, 28 Jan 2014 07:01:20 -0500 Received: from mail-ee0-x234.google.com ([2a00:1450:4013:c00::234]:55192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W87Ls-0004yg-2k for qemu-devel@nongnu.org; Tue, 28 Jan 2014 07:01:12 -0500 Received: by mail-ee0-f52.google.com with SMTP id e53so178158eek.25 for ; Tue, 28 Jan 2014 04:01:11 -0800 (PST) Date: Tue, 28 Jan 2014 13:01:08 +0100 From: Stefan Hajnoczi Message-ID: <20140128120108.GD16709@stefanha-thinkpad.redhat.com> References: <1390834386-23139-1-git-send-email-stefanha@redhat.com> <1390834386-23139-4-git-send-email-stefanha@redhat.com> <20140127151547.GK29958@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140127151547.GK29958@redhat.com> Subject: Re: [Qemu-devel] [PULL 3/4] trace: add glib 2.32+ static GMutex support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: Peter Maydell , qemu-devel@nongnu.org, Stefan Hajnoczi , Anthony Liguori 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 > > --- > > 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