[Spice-devel] [PATCH spice-gtk 06/10] usbredir: Add locking callbacks for libusbredirhost

Hans de Goede hdegoede at redhat.com
Sat Dec 24 01:31:48 PST 2011


On 12/23/2011 06:51 PM, Christophe Fergeau wrote:
> On Mon, Dec 19, 2011 at 12:24:39PM +0100, Hans de Goede wrote:
>> This is a preparation patch for handling usb packet completion in a
>> separate thread.
> Looks good, except that g_mutex_new/g_mutex_free are being deprecated in
> glib 2.31. The old symbols are still here so we should be fine for now, to
> avoid them we'll need to do something like
> GMutex *mutex;
> mutex = g_slice_new (GMutex);
> g_mutex_init (&mutex);
> return mutex;
> Obviously, g_mutex_init isn't in older glib otherwise things would be too
> easy so it will need to be conditional on glib version.
> No need to do it as part of this patch, we can add this later when glib
> 2.32 is released.

I already was aware of this (I hit this with gcompris which I maintain for
Fedora), I even had code much like the one you suggest using #ifdef's for the
reasons you give. But while testing I noticed I never got any deprecated warnings,
this is because we build with: -Wno-deprecated.

When removing the -Wno-deprecated I noticed that the usbredir code is not the
only trouble some part. So I decided to just use the code which will work
with both 2.32 and older versions without ifdef's for now, esp since this
will not be a problem for 2.32 since we use -Wno-deprecated anyways.

We should of course fix this sometime, but hopefully by then we can
just bump the minimum glib version requirement and avoid #ifdef's



More information about the Spice-devel mailing list