mtx_trylock() on a spin mutex
John Baldwin
jhb at freebsd.org
Tue Jan 31 14:48:00 UTC 2012
On Tuesday, January 31, 2012 6:35:08 am dmitry.krivenok at emc.com wrote:
> Hello,
> Could someone please explain why mtx_trylock() must not be called on a spin mutex?
> Is it conceptually wrong or is it a restriction of FreeBSD kernel implementation?
The current mutex API generally uses different methods for the different types of
mutexes (at some point I may split spin locks out into a completely separate
API to simplify things). If we wanted to do trylocks on spinlocks, then a new
mtx_trylock_spin() method would be added as you've done. To date we haven't had
any use cases for trylock operations on a spin lock. Even try locks on other
locking primitives are used fairly rarely.
--
John Baldwin
More information about the freebsd-hackers
mailing list