kernels/linux-2.4.0/arch/ia64/kernel/semaphore.c
/*
 * This gets called if we failed to acquire the lock, but we're biased
 * to acquire the lock by virtue of causing the count to change from 0
 * to -1.  Being biased, we sleep and attempt to grab the lock until
 * we succeed.  When this function returns, we own the lock.
 */
This gets called if we failed to acquire the lock, but we're biased
to acquire the lock by virtue of causing the count to change from 0
to -1.  Being biased, we sleep and attempt to grab the lock until
we succeed.  When this function returns, we own the lock.
This gets called if we failed to acquire the lock but we ' re biased to acquire the lock by virtue of causing the count to change from 0 to - 1 . Being biased we sleep and attempt to grab the lock until we succeed . When this function returns we own the lock .
static inline void
down_read_failed_biased (struct rw_semaphore *sem)
{
	struct task_struct *tsk = current;
	DECLARE_WAITQUEUE(wait, tsk);
	add_wait_queue(&sem->wait, &wait);	
	for (;;) {
		if (sem->read_bias_granted && xchg(&sem->read_bias_granted, 0))
			break;
		set_task_state(tsk, TASK_UNINTERRUPTIBLE);
		if (!sem->read_bias_granted)
			schedule();
	}
	remove_wait_queue(&sem->wait, &wait);
	tsk->state = TASK_RUNNING;
}
static inline void down_read_failed_biased ( struct rw_semaphore * sem ) { struct task_struct * tsk = current ; DECLARE_WAITQUEUE ( wait , tsk ) ; add_wait_queue ( & sem -> wait , & wait ) ; for ( ; ; ) { if ( sem -> read_bias_granted && xchg ( & sem -> read_bias_granted , 0 ) ) break ; set_task_state ( tsk , TASK_UNINTERRUPTIBLE ) ; if ( ! sem -> read_bias_granted ) schedule ( ) ; } remove_wait_queue ( & sem -> wait , & wait ) ; tsk -> state = TASK_RUNNING ; }
This gets called if we failed to acquire the lock, but we're biased
 to acquire the lock by virtue of causing the count to change from 0
 to -1.
This gets called if we failed to acquire the lock but we ' re biased to acquire the lock by virtue of causing the count to change from 0 to - 1 .
/* put ourselves at the head of the list */