Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 595815 - pthread_spin_lock() blocks instead of returning EDEADLK
pthread_spin_lock() blocks instead of returning EDEADLK
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: glibc (Show other bugs)
5.5
All Linux
low Severity medium
: rc
: ---
Assigned To: Andreas Schwab
qe-baseos-tools
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-25 12:57 EDT by Geoff Levner
Modified: 2016-11-24 11:10 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-05-26 09:17:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test program illustrating the bug (709 bytes, text/x-csrc)
2010-05-25 12:57 EDT, Geoff Levner
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
CentOS 4331 None None None Never

  None (edit)
Description Geoff Levner 2010-05-25 12:57:40 EDT
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.
Comment 1 Andreas Schwab 2010-05-26 09:17:08 EDT
http://opengroup.org/onlinepubs/9699919799/functions/pthread_spin_lock.html

The results are undefined if the calling thread holds the lock at the time the call is made.
Comment 2 Charlie Brady 2010-06-01 17:57:47 EDT
(In reply to comment #1)

> http://opengroup.org/onlinepubs/9699919799/functions/pthread_spin_lock.html
> 
> 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.
Comment 3 Geoff Levner 2010-06-02 04:46:32 EDT
(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).

Note You need to log in before you can comment on or make changes to this bug.