tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: struct ifnet and ifaddr handling [was: Re: Making global variables of if.c MPSAFE]
Date: Wed, 19 Nov 2014 12:51:06 +0900
From: Ryota Ozaki <ozaki-r%netbsd.org@localhost>
On Wed, Nov 19, 2014 at 3:11 AM, Taylor R Campbell
<campbell+netbsd-tech-kern%mumble.net@localhost> wrote:
> do {
> refcnt = m->m_refcnt;
> if (refcnt == 1) {
> mutex_enter(&m->m_lock);
> refcnt = atomic_dec_uint_nv(&m->m_refcnt);
> if (refcnt == 0)
> cv_broadcast(&m->m_cv);
> mutex_exit(&m->m_lock);
> }
> } while (atomic_cas_uint(&m->m_refcnt, refcnt, refcnt - 1) != refcnt);
BTW, do we need break after mutex_exit? Otherwise, m->m_refcnt is likely
to be decremented twice when refcnt == 1.
Yes -- typo in my hastily-written uncompiled untested code.
Home |
Main Index |
Thread Index |
Old Index