qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] libcacard: replace qemu thread primitives with


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] libcacard: replace qemu thread primitives with glib ones
Date: Mon, 28 Apr 2014 11:19:16 +0100

On 27 April 2014 17:26, Michael Tokarev <address@hidden> wrote:
> Replace QemuMutex with GMutex and QemuCond with GCond
> (with corresponding function changes), to make libcacard
> independent of qemu internal functions.

> --- a/libcacard/event.c
> +++ b/libcacard/event.c
> @@ -43,13 +43,13 @@ vevent_delete(VEvent *vevent)
>
>  static VEvent *vevent_queue_head;
>  static VEvent *vevent_queue_tail;
> -static QemuMutex vevent_queue_lock;
> -static QemuCond vevent_queue_condition;
> +static GMutex vevent_queue_lock;
> +static GCond vevent_queue_condition;
>
>  void vevent_queue_init(void)
>  {
> -    qemu_mutex_init(&vevent_queue_lock);
> -    qemu_cond_init(&vevent_queue_condition);
> +    g_mutex_init(&vevent_queue_lock);
> +    g_cond_init(&vevent_queue_condition);
>      vevent_queue_head = vevent_queue_tail = NULL;
>  }

Just to record a conversation from IRC: this won't
compile on older versions of glib, because those don't
support g_cond_init(). Conversely, if you use g_cond_new()
then newer glib will complain that it's deprecated.
trace/simple.c has an example of how you have to work
around this API churn...

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]