From 0a37669aa5d98875e783df75681f035a905b7f31 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 16 Feb 2003 10:57:38 +0000 Subject: Update. * tst-rwlock6.c: More pthread_rwlock_timedwrlock and pthread_rwlock_timedrdlock tests. * tst-rwlock7.c: More pthread_rwlock_timedwrlock tests. * sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S: Check for invalid tv_nsec field. * sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S: Likewise. * pthread_mutex_trylock.c (__pthread_mutex_trylock): Protect recursive mutex of overflow. * tst-attr1.c (do_test): Add test for pthread_mutexattr_setpshared. --- nptl/tst-rwlock7.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'nptl/tst-rwlock7.c') diff --git a/nptl/tst-rwlock7.c b/nptl/tst-rwlock7.c index 41e5af3ba8..4d7af6ca77 100644 --- a/nptl/tst-rwlock7.c +++ b/nptl/tst-rwlock7.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -76,6 +76,24 @@ tf (void *arg) pthread_exit ((void *) 1l); } + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_sec += 10; + /* Note that the following operation makes ts invalid. */ + ts.tv_nsec += 1000000000; + + err = pthread_rwlock_timedwrlock (r, &ts); + if (err == 0) + { + puts ("2nd timedwrlock succeeded"); + pthread_exit ((void *) 1l); + } + if (err != EINVAL) + { + puts ("2nd timedwrlock did not return EINVAL"); + pthread_exit ((void *) 1l); + } + return NULL; } @@ -124,7 +142,7 @@ do_test (void) /* Get a read lock. */ if (pthread_rwlock_timedrdlock (&r, &ts) != 0) { - printf ("round %d: rwlock_wrlock failed\n", cnt); + printf ("round %d: rwlock_timedrdlock failed\n", cnt); exit (1); } -- cgit v1.2.3