[Spice-devel] [PATCH spice-gtk 06/10] usbredir: Add locking callbacks for libusbredirhost
Hans de Goede
hdegoede at redhat.com
Tue Jan 3 01:14:59 PST 2012
Hi,
On 12/28/2011 01:14 PM, Marc-André Lureau wrote:
>
>
> On Mon, Dec 19, 2011 at 12:24 PM, Hans de Goede <hdegoede at redhat.com <mailto:hdegoede at redhat.com>> wrote:
>
> +static void *usbredir_alloc_lock(void);
> +static void usbredir_lock_lock(void *user_data);
> +static void usbredir_unlock_lock(void *user_data);
> +static void usbredir_free_lock(void *user_data);
> +
>
>
> Minor nitpicks, I think it would be a bit less verbose and more pleasant to read if you would just use casts for calling glib flavours of mutexes.
Done.
> Would there be drawbacks if the library would simply use the equivalent of GStaticMutex instead?
The user of the lib specifying the locking functions has 2 purposes:
1) They can be NULL, and no locking is done
2) Different C-runtimes have different thread primitives. This is less of an issue on linux now
a days, but I'm not sure what the situation is on other platforms. By allowing the user of the
lib to provide the locking functions we're sure they will be compatible with whatever the user
is using for its own locking.
Regards,
Hans
More information about the Spice-devel
mailing list