kernels/linux-2.4.0/include/asm-mips64/semaphore.h
/* When a reader does a release, the only significant case is when
   there was a writer waiting, and we've bumped the count to 0: we must
   wake the writer up.  */
When a reader does a release, the only significant case is when
there was a writer waiting, and we've bumped the count to 0: we must
wake the writer up.
When a reader does a release the only significant case is when there was a writer waiting and we ' ve bumped the count to 0 : we must wake the writer up .
static inline void up_read(struct rw_semaphore *sem)
{
	int count;
#if WAITQUEUE_DEBUG
	CHECK_MAGIC(sem->__magic);
	if (sem->granted & 2)
		BUG();
	if (atomic_read(&sem->writers))
		BUG();
	atomic_dec(&sem->readers);
#endif
	mb();
	count = atomic_inc_return(&sem->count);
	if (count == 0) {
		__rwsem_wake(sem, 0);
	}
}
static inline void up_read ( struct rw_semaphore * sem ) { int count ; #if WAITQUEUE_DEBUG CHECK_MAGIC ( sem -> __magic ) ; if ( sem -> granted & 2 ) BUG ( ) ; if ( atomic_read ( & sem -> writers ) ) BUG ( ) ; atomic_dec ( & sem -> readers ) ; #endif mb ( ) ; count = atomic_inc_return ( & sem -> count ) ; if ( count == 0 ) { __rwsem_wake ( sem , 0 ) ; } }
When a reader does a release, the only significant case is when
there was a writer waiting, and we've bumped the count to 0: we must
wake the writer up.
When a reader does a release the only significant case is when there was a writer waiting and we ' ve bumped the count to 0 : we must wake the writer up .