From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7nuv-0005Z3-9v for qemu-devel@nongnu.org; Mon, 27 Jan 2014 10:16:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7nun-0007Jk-AF for qemu-devel@nongnu.org; Mon, 27 Jan 2014 10:16:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7nun-0007JZ-2c for qemu-devel@nongnu.org; Mon, 27 Jan 2014 10:15:57 -0500 Date: Mon, 27 Jan 2014 15:15:47 +0000 From: "Daniel P. Berrange" Message-ID: <20140127151547.GK29958@redhat.com> References: <1390834386-23139-1-git-send-email-stefanha@redhat.com> <1390834386-23139-4-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1390834386-23139-4-git-send-email-stefanha@redhat.com> Subject: Re: [Qemu-devel] [PULL 3/4] trace: add glib 2.32+ static GMutex support Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Peter Maydell , qemu-devel@nongnu.org, Anthony Liguori 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) ? 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 :|