This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nptl/15988] New: tst-mutexpi8 test case failure on non-x86 systems


https://sourceware.org/bugzilla/show_bug.cgi?id=15988

            Bug ID: 15988
           Summary: tst-mutexpi8 test case failure on non-x86 systems
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: siddhesh at redhat dot com
          Reporter: siddhesh at redhat dot com
                CC: drepper.fsp at gmail dot com

tst-mutexpi8 test case fails on non-x86 boxes (tested s390 and got a similar
report for ppc) for recursive mutexes.  Here's a reproducer that produces the
same failure.

#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

pthread_mutex_t mutex;
pthread_mutexattr_t attr;
pthread_cond_t cond;
pthread_t tid;

void *callback(void *arg){
        for (;;){
                sleep(2);
                pthread_mutex_lock(&mutex);
                printf("Wake up!\n");
                pthread_cond_broadcast(&cond);
                pthread_mutex_unlock(&mutex);
        }
}

int main(){
        pthread_mutexattr_init(&attr);
        pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
        pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT);
        pthread_mutex_init(&mutex, &attr);
        pthread_cond_init(&cond, NULL);

        pthread_mutex_lock(&mutex);
        pthread_create(&tid, NULL, callback, &cond);

        printf("Going to sleep\n");
        for(;;){
                pthread_cond_wait(&cond, &mutex);
                printf("OK\n");
                exit(0);
        }
}

Actual results:

Going to sleep
Wake up!
Wake up!
Wake up!
Wake up!
Wake up!
Wake up!
Wake up!
Wake up!
Wake up!
Wake up!
Wake up!
Wake up!
...

Expected Result:

Going to sleep
Wake up!
OK

Patch coming soon.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]