Re: [PATCH] trylock for rw_semaphores: 2.4.1

2001-02-20 Thread Brian J. Watson
Ben LaHaise wrote: > How about the following instead? Warning: compiled, not tested. > > -ben > > +/* returns 1 if it successfully obtained the semaphore for write */ > +static inline int down_write_trylock(struct rw_semaphore *sem) > +{ > + int old = RW_LOCK_BIAS, new = 0

Re: [PATCH] trylock for rw_semaphores: 2.4.1

2001-02-19 Thread Ben LaHaise
On Mon, 19 Feb 2001, Brian J. Watson wrote: > Here is an x86 implementation of down_read_trylock() and down_write_trylock() > for read/write semaphores. As with down_trylock() for exclusive semaphores, they > don't block if they fail to get the lock. They just return 1, as opposed to 0 in > the s

[PATCH] trylock for rw_semaphores: 2.4.1

2001-02-19 Thread Brian J. Watson
Here is an x86 implementation of down_read_trylock() and down_write_trylock() for read/write semaphores. As with down_trylock() for exclusive semaphores, they don't block if they fail to get the lock. They just return 1, as opposed to 0 in the success case. The algorithm should be robust. It shou