kernels/linux-2.4.0/arch/parisc/kernel/semaphore.c
/* Wait for the lock to become unbiased. Since we're
 * a writer, we'll make ourselves exclusive.
 */
Wait for the lock to become unbiased. Since we're
a writer, we'll make ourselves exclusive.
Wait for the lock to become unbiased . Since we ' re a writer we ' ll make ourselves exclusive .
void down_write_failed(struct rw_semaphore *sem)
{
	DECLARE_WAITQUEUE(wait, current);
	__up_write(sem);	
	add_wait_queue_exclusive(&sem->wait, &wait);
	while (atomic_read(&sem->count) < 0) {
		set_task_state(current, TASK_UNINTERRUPTIBLE | TASK_EXCLUSIVE);
		if (atomic_read(&sem->count) >= 0)
			break;	
		schedule();
	}
	remove_wait_queue(&sem->wait, &wait);
	current->state = TASK_RUNNING;
}
void down_write_failed ( struct rw_semaphore * sem ) { DECLARE_WAITQUEUE ( wait , current ) ; __up_write ( sem ) ; add_wait_queue_exclusive ( & sem -> wait , & wait ) ; while ( atomic_read ( & sem -> count ) < 0 ) { set_task_state ( current , TASK_UNINTERRUPTIBLE | TASK_EXCLUSIVE ) ; if ( atomic_read ( & sem -> count ) >= 0 ) break ; schedule ( ) ; } remove_wait_queue ( & sem -> wait , & wait ) ; current -> state = TASK_RUNNING ; }
Wait for the lock to become unbiased.
Wait for the lock to become unbiased .
/* this takes care of granting the lock */ /* we must attempt to aquire or bias the lock */