Re: Holding a spinlock
Re: Holding a spinlock
- Subject: Re: Holding a spinlock
- From: John Kraft <email@hidden>
- Date: Sun, 04 Sep 2016 00:44:57 +0000
- Thread-topic: Holding a spinlock
We use IOSimpleLocks from the IOKit for this. These are just wrappers around the lck primitives, though.
________________________________________
From: darwin-kernel-bounces+jfk=email@hidden <darwin-kernel-bounces+jfk=email@hidden> on behalf of Adriaan van Os <email@hidden>
Sent: Saturday, September 3, 2016 2:13 PM
To: email@hidden
Subject: Holding a spinlock
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.
_______________________________________________
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