tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: mutex question
> On Jul 6, 2018, at 4:48 PM, Phil Nelson <phil%NetBSD.org@localhost> wrote:
>
> Hello,
>
> The FreeBSD 802.11 code is using a call to mtx_sleep(). The define is:
>
> #define mtx_sleep(chan, mtx, pri, wmesg, timo) \
> _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \
> tick_sbt * (timo), 0, C_HARDCLOCK)
In NetBSD, you could use mtsleep(), but the best way to do this is with kcondvar_t's. Each "wait channel" really become a discrete condition variable that is initialized separately, and you'd use cv_wait() for non-timeout sleeps and cv_timedwait() for timeout sleeps. The "pri" argument is unneeded because the priority comes from the LWP that's sleeping, and the condvars do priority inheritance / boosting via turnstiles as needed.
>
>
> Just in case I can save time by getting an answer by asking before digging deep ...
> does anyone know what I should translate this to in NetBSD? Our mutex routines
> do not appear to have any similar call.
>
> --Phil
-- thorpej
Home |
Main Index |
Thread Index |
Old Index