qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 06/11] coroutine-lock: make CoMutex thread-safe


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 06/11] coroutine-lock: make CoMutex thread-safe
Date: Tue, 17 May 2016 17:34:30 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0


On 29/04/2016 08:26, Fam Zheng wrote:
> > +        if (to_wake) {
> > +            Coroutine *co = to_wake->co;
> > +            qemu_coroutine_wake(co->ctx, co);
> > +            goto out;
> > +        }
> > +
> > +        /* Some concurrent lock() is in progress (we know this because of
> > +         * count) but it hasn't yet put itself on the wait queue.
> 
> Unlike OSv's lfmutex.cc, we don't seem to have count. Should the comment say
> "locked" instead?

Yes; we know at least one lock() is in progress because we found
mutex->locked > 1.  locked cannot decrease until unlock() wakes up
someone or until a concurrent lock() completes a handoff---which must be
after unlock() writes a nonzero value tomutex->handoff

Paolo



reply via email to

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