|
Description
|
This was reported by David Bartley < xxxxx@xxxxx.ca>
on opensolaris- xxxxx@xxxxx.org :
pthread_mutex_timedlock does not return when passed a valid abstime if mutex
is a priority inherit mutex. The attached test case demonstrates the bug.
Ths (slightly revised) test case is:
/* compile as 'gcc pthread_mutex_timedlock-PI.c' */
#include <pthread.h>
#include <time.h>
#include <unistd.h>
#include <signal.h>
#include <assert.h>
#include <errno.h>
/* ARGSUSED */
static void
intr(int sig)
{
}
int
main()
{
pthread_mutexattr_t a;
pthread_mutex_t m;
struct timespec t;
int err;
assert(sigset(SIGALRM, intr) == SIG_DFL);
assert(pthread_mutexattr_init(&a) == 0);
#ifndef NO_PI
assert(pthread_mutexattr_setprotocol(&a, PTHREAD_PRIO_INHERIT) == 0);
#endif
assert(pthread_mutex_init(&m, &a) == 0);
assert(pthread_mutex_lock(&m) == 0);
assert(alarm(2) == 0);
assert(clock_gettime(CLOCK_REALTIME, &t) == 0);
t.tv_sec += 5;
/* this should block for 5 seconds */
err = pthread_mutex_timedlock(&m, &t);
assert(err == ETIMEDOUT);
return (0);
}
|