Subject: Re: Lock benchmarks
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-kern
Date: 09/18/2002 18:31:59
Jason R Thorpe <thorpej@wasabisystems.com> writes:
> ...and, actually, there is one place where __cpu_simple_lock() is used
> in libpthread: pthread_spin_lock().
>
> That function should be changed to use a loop around __cpu_simple_lock_try()
> and detect deadlock and return the EDEADLK error.
Bwahahaha.
The pthread_spin_lock() function is specified as a "you are likely to
lose" function. It would be easy to make it loop around
__cpu_simple_lock_try(), but it is under no obligation whatsoever to
detect deadlock (which would anyway only be valid if the *calling
thread* already held the lock).
There's a good reason that the internal spinlock primitives in the
pthread library are different from pthread_spin_lock().
- Nathan