View Issue Details

IDProjectCategoryView StatusLast Update
0004331CentOS-5glibcpublic2010-05-25 17:01
Reporterglevner Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version5.4 
Summary0004331: pthread_spin_lock() blocks instead of returning EDEADLK
DescriptionAccording 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.
Additional InformationThe bug can be reproduced using the attached test program.
TagsNo tags attached.

Activities

2010-05-21 10:51

 

spintest.c (709 bytes)   
#include <pthread.h>
#include <string.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    pthread_spinlock_t lock;
    int err;

    if ((err = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE)) != 0) {
        fprintf(stderr, "pthread_spin_init: %s\n", strerror(err));
        return err;
    }

    if ((err = pthread_spin_lock(&lock)) != 0) {
        fprintf(stderr, "pthread_spin_lock: %s\n", strerror(err));
        return err;
    }

    puts("lock successful, trying to lock again");

    // should return EDEADLK, blocks instead...
    if ((err = pthread_spin_lock(&lock)) != 0) {
        fprintf(stderr, "pthread_spin_lock: %s\n", strerror(err));
        return err;
    }

    return 0;
}
spintest.c (709 bytes)   
glevner

glevner

2010-05-25 09:28

reporter   ~0011336

CentOS 5.5 with glibc 2.5.49 has the same problem.
glevner

glevner

2010-05-25 17:01

reporter   ~0011337

Bug posted to Red Hat as well: https://bugzilla.redhat.com/show_bug.cgi?id=595815

Issue History

Date Modified Username Field Change
2010-05-21 10:51 glevner New Issue
2010-05-21 10:51 glevner File Added: spintest.c
2010-05-25 09:28 glevner Note Added: 0011336
2010-05-25 17:01 glevner Note Added: 0011337