[Spice-devel] [PATCH spice-gtk 06/10] usbredir: Add locking callbacks for libusbredirhost
Christophe Fergeau
cfergeau at redhat.com
Wed Jan 4 00:44:40 PST 2012
Hi Hans,
On Tue, Jan 03, 2012 at 10:14:59AM +0100, Hans de Goede wrote:
> 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.
>
Unfortunately, this doesn't work:
priv->host = usbredirhost_open_full(
priv->context,
handle, usbredir_log,
usbredir_read_callback,
usbredir_write_callback,
usbredir_write_flush_callback,
(usbredirparser_alloc_lock)g_mutex_new,
(usbredirparser_lock)g_mutex_lock,
(usbredirparser_unlock)g_mutex_unlock,
(usbredirparser_free_lock)g_mutex_free,
channel, PACKAGE_STRING,
spice_util_get_debug() ? usbredirparser_debug : usbredirparser_warning,
usbredirhost_fl_write_cb_owns_buffer);
It gives me:
CC channel-usbredir.lo
channel-usbredir.c: In function 'spice_usbredir_channel_open_device':
channel-usbredir.c:193:63: error: 'g_mutex_new' undeclared (first use in
this function)
channel-usbredir.c:193:63: note: each undeclared identifier is reported
only once for each function it appears in
channel-usbredir.c:194:57: error: 'g_mutex_lock' undeclared (first use in
this function)
channel-usbredir.c:195:59: error: 'g_mutex_unlock' undeclared (first use in
this function)
channel-usbredir.c:196:62: error: 'g_mutex_free' undeclared (first use in
this function)
make[2]: *** [channel-usbredir.lo] Erreur 1
Looking in /usr/include/glib-2.0/glib/gthread.h, g_mutex_new is defined as:
#define g_mutex_new() G_THREAD_UF (mutex_new, ())
which then expands to a (*g_thread_functions_for_glib_use . mutex_new) ()
If I'm not mistaken, the preprocessor won't replace "foo" even when foo()
is #defined, and this is the issue we're having here. We probably need to
go back to your first version of the patch...
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120104/8c836499/attachment.pgp>
More information about the Spice-devel
mailing list