[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A938BD5.1050302@gnu.org>
Date: Tue, 25 Aug 2009 08:59:33 +0200
From: Paolo Bonzini <bonzini@....org>
To: Davide Libenzi <davidel@...ilserver.org>
CC: Avi Kivity <avi@...hat.com>, "Michael S. Tsirkin" <mst@...hat.com>,
gleb@...hat.com, kvm@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0/2] eventfd: new EFD_STATE flag
>>> There are userspace libraries that do almost everything, but you hardly
>>> see things like pthread_(EFD_STATE-like)_create() or similar system
>>> interfaces based on such abstraction.
>>
>> It actually seems as close to a condition variable as an eventfd can be.
>
> A pthread condition typical code usage maps to eventfd like:
>
> while (read(efd, ...)> 0)
> if (CONDITION)
> break;
>
> So a pthread condition is really a wakeup gate like eventfd is.
> EFD_STATE has nothing to do with a pthread condition.
No, your code does not work for pthread_cond_broadcast (which arguably
is the common case) because all the eventfd readers after the first
would block.
Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists