tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: would a mutex_wait be useful?
Matt Thomas <matt%3am-software.com@localhost> wrote:
> > Where/when do you need interruptible mutex?
>
> I was replacing code in arm32/mem.c with a home grown lock with
> mutex_enter.
> Relatively easy to do except it no longer does PCATCH.
I agree with Antti that code asks for condvar(9), at least.
> > That does not sound like a good API. If specific synchronisation is
> > needed,
> > I think wrappers with mutex_tryenter() could be used for that.
>
> Not easily. And rolling your own seems wrong. Hence the proposal
> for a common method to do it.
Why wrong? If somebody holds your mutex for a long time, then it is not
MP-friendly and needs fixing/improving. In a case of coarse-grained locking,
long holds and contention are expected, and wrappers might have a use here.
--
Best regards,
Mindaugas
Home |
Main Index |
Thread Index |
Old Index