Created attachment 416453 [details]
test program illustrating the bug
According to the man page, pthread_spin_lock() should fail and return EDEADLK if the given lock is already held by the calling thread. In fact it blocks.
The bug can be reproduced using the attached test program.
The results are undefined if the calling thread holds the lock at the time the call is made.
(In reply to comment #1)
> The results are undefined if the calling thread holds the lock at the time the
> call is made.
In that case, the man page is incorrect (according to Geoff's assertion - I haven't checked), and should be updated. Bug should be re-opened.
(In reply to comment #2)
The man page is ambiguous. It does indeed say that the results are undefined if the calling thread holds the lock at the time the call is made. But it also says, in the section on return codes, that pthread_spin_lock() may return EDEADLK if that is the case (which would be quite useful).