On 28/09/2015 12:15, Stefan Hajnoczi wrote:
> On Thu, Aug 06, 2015 at 03:36:01PM +0200, Paolo Bonzini wrote:
>> > +int qemu_lockcnt_count(QemuLockCnt *lockcnt);
> Why use int here when the counter field is unsigned?
Nice catch, will fix.
Paolo
On Thu, Aug 06, 2015 at 03:36:01PM +0200, Paolo Bonzini wrote:
> +int qemu_lockcnt_count(QemuLockCnt *lockcnt);
Why use int here when the counter field is unsigned?
On Thu, 08/06 15:36, Paolo Bonzini wrote:
> +QemuLockCnt usage
> +-
> +
> +The typical pattern for QemuLockCnt functions is as follows.
> +
> +qemu_lockcnt_inc(_lockcnt);
> +if (xyz) {
> +... access xyz ...
> +}
> +
> +if
On 09/09/2015 10:49, Fam Zheng wrote:
>> > +qemu_lockcnt_inc(_handlers_lockcnt);
>> > +QLIST_FOREACH_RCU(ioh, _handlers, pioh) {
>> > +if (ioh->revents & G_IO_OUT) {
>> > +ioh->fd_write(ioh->opaque);
>> > +}
>> > +}
> I'm confused, the comment of
A QemuLockCnt comprises a counter and a mutex, with primitives
to increment and decrement the counter, and to take and release the
mutex. It can be used to do lock-free visits to a data structure
whenever mutexes would be too heavy-weight and the critical section
is too long for RCU.
This could