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:
> 
> 
> I'd like to be able to do a mutex_enter(9) which could be interruptable.
> If interrupted, it would return the error why it was interrupted.

Where/when do you need interruptible mutex?

> Maybe called int mutex_wait(kmutex_t *mtx, int ticks); and if ticks == 0
> becomes (mutex_tryenter(mtx) ? 0 : ETIMEOUT).  If tick == -1, means
> wait forever.
> 
> mutex_wait would use PCATCH for its sleeps and return EINTR if a signal
> was caught.

That does not sound like a good API. If specific synchronisation is needed,
I think wrappers with mutex_tryenter() could be used for that.

-- 
Best regards,
Mindaugas


Home | Main Index | Thread Index | Old Index