Holding a spinlock
Holding a spinlock
- Subject: Holding a spinlock
- From: Adriaan van Os <email@hidden>
- Date: Sat, 03 Sep 2016 23:13:20 +0200
The Kernel Programming Guide in the Synchronization Primitives chapter says the following in the
Locks section, Spinlocks subsection
Note that a thread may not block while holding a spinlock, because that could cause deadlock.
Further, preemption is disabled on a given processor while a spinlock is held.
I assume the code will be something like (in Linux <http://www.makelinux.net/books/lkd2/ch06lev1sec7>)
local_irq_disable();
spin ....
local_irq_enable();
However, I haven't been able to locate the code that does this or similar, at least not in
osfmk/kern/locks.c. What is the recommended practice on Mac OS X ? I mean, apart from using the
lck_ functions, who are not practical to use in my case.
Regards,
Adriaan van Os
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden