diff options
author | Neal H. Walfield <neal@gnu.org> | 2005-05-12 20:55:38 +0000 |
---|---|---|
committer | Neal H. Walfield <neal@gnu.org> | 2005-05-12 20:55:38 +0000 |
commit | a2c46ac956613c162b5162d2ef2c725229b08aca (patch) | |
tree | e32ddcbb1888e6c92f1408a73a10795ebb4e1c18 /sysdeps/generic/pt-rwlock-timedrdlock.c | |
parent | a6dffc4afcfb78fbb043971ecffdf5a2cfa60989 (diff) |
libpthread/
2005-05-12 Neal H. Walfield <neal@gnu.org>
* include/pthread/pthread.h (pthread_exit): Add noreturn
attribute.
* sysdeps/generic/bits/condition.h (__PTHREAD_COND_INITIALIZER):
Don't create a compound literal.
* sysdeps/generic/bits/mutex.h (__PTHREAD_MUTEX_INITIALIZER):
Don't create a compound literal.
(pthread_mutex_init): Don't assign to *__MUTEX directly.
Initialize an intermediate local variable and then copy the
result.
* sysdeps/generic/bits/rwlock.h (__PTHREAD_RWLOCK_INITIALIZER):
Don't create a compound literal.
(pthread_rwlock_init): Don't assign to *__RWLOCK directly.
Initialize an intermediate local variable and then copy the
result.
* sysdeps/i386/bits/spin-lock.h (__SPIN_LOCK_INITIALIZER):
Don't create a compound literal.
* pthread/pt-alloc.c (initialize_pthread): Cast
PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER to create a
compound literal.
* tests/test-1.c (main): Use pthread_mutex_init, not
PTHREAD_MUTEX_INIT for mutex initialization
* sysdeps/generic/pt-barrier-init.c (pthread_barrier_init): Remove
assert. Copy ATTR if non-defaults are used.
* sysdeps/generic/pt-cond-init.c (pthread_cond_init): Include
<string.h>. Remove assert. Copy ATTR if non-defaults are used.
* sysdeps/generic/pt-mutex-init.c (_pthread_mutex_init): Cast
PTHREAD_MUTEX_INITIALIZER to create a compound literal.
* sysdeps/generic/pt-rwlock-init.c: Include <string.h>.
(_pthread_rwlock_init): Cast __PTHREAD_RWLOCK_INITIALIZER to
create a compound literal. Copy ATTR if non-defaults are used.
* sysdeps/generic/pt-cond-timedwait.c
(__pthread_cond_timedwait_internal): Check that ABSTIME->TV_NSEC
is valid. Don't shadow ERR. Don't return before cleaning up.
* sysdeps/generic/pt-mutex-timedlock.c (pthread_mutex_timedlock):
Move after __pthread_mutex_timedlock_internal. Check that
ABSTIME->TV_NSEC is valid.
* sysdeps/generic/pt-rwlock-timedrdlock.c
(pthread_rwlock_timedrdlock): Move after.
__pthread_rwlock_timedrdlock_internal.
(__pthread_rwlock_timedrdlock_internal): Check that
ABSTIME->TV_NSEC is valid.
* sysdeps/generic/pt-rwlock-timedwrlock.c
(pthread_rwlock_timedwrlock): Move after
__pthread_rwlock_timedwrlock_internal.
(__pthread_rwlock_timedwrlock_internal): Check that
ABSTIME->TV_NSEC is valid.
* sysdeps/generic/sem-timedwait.c (__sem_timedwait_internal):
Check that TIMEOUT->TV_NSEC is valid before enqueuing the thread.
* sysdeps/generic/pt-rwlock-rdlock.c
(__pthread_rwlock_timedrdlock_internal): Fix declaration.
* sysdeps/generic/pt-mutex-trylock.c (__pthread_mutex_trylock):
Don't return EDEADLK. POSIX does not allow it.
* sysdeps/mach/pt-timedblock.c (__pthread_timedblock): Calculate
the relative timeout without overflowing.
* sysdeps/mach/hurd/i386/pt-setup.c (stack_setup): Cast THREAD.
Diffstat (limited to 'sysdeps/generic/pt-rwlock-timedrdlock.c')
-rw-r--r-- | sysdeps/generic/pt-rwlock-timedrdlock.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sysdeps/generic/pt-rwlock-timedrdlock.c b/sysdeps/generic/pt-rwlock-timedrdlock.c index 85cb946..ba610fa 100644 --- a/sysdeps/generic/pt-rwlock-timedrdlock.c +++ b/sysdeps/generic/pt-rwlock-timedrdlock.c @@ -1,5 +1,5 @@ /* Acquire a rwlock for reading. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,13 +22,6 @@ #include <pt-internal.h> -int -pthread_rwlock_timedrdlock (struct __pthread_rwlock *rwlock, - const struct timespec *abstime) -{ - return __pthread_rwlock_timedrdlock_internal (rwlock, abstime); -} - /* Acquire the rwlock *RWLOCK for reading blocking until *ABSTIME if it is already held. As a GNU extension, if TIMESPEC is NULL then wait forever. */ @@ -66,6 +59,9 @@ __pthread_rwlock_timedrdlock_internal (struct __pthread_rwlock *rwlock, /* Better be blocked by a writer. */ assert (rwlock->readers == 0); + if (abstime && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)) + return EINVAL; + self = _pthread_self (); /* Add ourself to the queue. */ @@ -108,3 +104,10 @@ __pthread_rwlock_timedrdlock_internal (struct __pthread_rwlock *rwlock, return 0; } + +int +pthread_rwlock_timedrdlock (struct __pthread_rwlock *rwlock, + const struct timespec *abstime) +{ + return __pthread_rwlock_timedrdlock_internal (rwlock, abstime); +} |