Subject: Re: Lock benchmarks
To: Jason R Thorpe <>
From: Nathan J. Williams <>
List: tech-kern
Date: 09/18/2002 18:41:32
Jason R Thorpe <> writes:

> On Wed, Sep 18, 2002 at 06:31:59PM -0400, Nathan J. Williams wrote:
>  > 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).
> Sure, but the EDEADLK return value is allowed by POSIX, and I don't see
> a good reason why we shouldn't support it.

It requires the overhead of tracking the owner of the spinlock, which
goes against the intent of POSIX that spinlocks be fast and merciless.

        - Nathan