BSP and Device Driver Development Guide
The Shm_Lock routine is responsible for
acquiring the lock field. Interrupts should be
disabled while that lock is acquired. If the lock
is currently unavailble, then the locking routine
should delay a few microseconds to allow the other
node to release the lock. Doing this reduces bus contention
for the lock. This routines usually is implemented as follows:
void Shm_Lock(
Shm_Locked_queue_Control *lq_cb
)
{
disable processor interrupts
set Shm_isrstat to previous interrupt disable level
while ( TRUE ) {
atomically attempt to acquire the lock
if the lock was acquired
return
delay some small period of time
}
}
BSP and Device Driver Development Guide
Copyright © 1988-2004 OAR Corporation