diff options
author | Glenn Humphrey <glenn.humphrey@oarcorp.com> | 2007-11-06 19:52:36 +0000 |
---|---|---|
committer | Glenn Humphrey <glenn.humphrey@oarcorp.com> | 2007-11-06 19:52:36 +0000 |
commit | 8a8f5b263ae4a42b85a2d0c4a598b9702e04a57e (patch) | |
tree | 8ee935170b0b7bb403d9be6082cdaff91adb9063 /cpukit/posix/src/prwlockinit.c | |
parent | 2007-11-06 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-8a8f5b263ae4a42b85a2d0c4a598b9702e04a57e.tar.bz2 |
2007-11-06 Glenn Humphrey <glenn.humphrey@OARcorp.com>
Miscellaneous changes made after a review against the POSIX spec.
* posix/src/pbarrierinit.c, posix/src/prwlockinit.c: If the caller
passes a NULL in the attributes parameter, default attributes are used.
* posix/src/prwlockdestroy.c: If there is at least one thread
waiting, do not allow deletion.
* posix/src/prwlockwrlock.c: Corrected parameter passed to the core
operation used to obtain a RWLock for writing.
* posix/src/pspinlocktranslatereturncode.c,
score/include/rtems/score/corespinlock.h,
score/src/corespinlockrelease.c: If the current thread is not the
holder of the lock, do not allow an unlock and return EPERM.
* score/src/corerwlockobtainwrite.c: Corrected to use the operation
for queueing with a timeout handler.
Diffstat (limited to 'cpukit/posix/src/prwlockinit.c')
-rw-r--r-- | cpukit/posix/src/prwlockinit.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/cpukit/posix/src/prwlockinit.c b/cpukit/posix/src/prwlockinit.c index 6d6fe1a2c4..7149a68e09 100644 --- a/cpukit/posix/src/prwlockinit.c +++ b/cpukit/posix/src/prwlockinit.c @@ -41,16 +41,30 @@ int pthread_rwlock_init( const pthread_rwlockattr_t *attr ) { - POSIX_RWLock_Control *the_rwlock; - CORE_RWLock_Attributes the_attributes; - - + POSIX_RWLock_Control *the_rwlock; + CORE_RWLock_Attributes the_attributes; + pthread_rwlockattr_t default_attr; + const pthread_rwlockattr_t *the_attr; + + /* + * Error check parameters + */ if ( !rwlock ) return EINVAL; - if ( !attr ) - return EINVAL; + /* + * If the user passed in NULL, use the default attributes + */ + if ( attr ) { + the_attr = attr; + } else { + (void) pthread_rwlockattr_init( &default_attr ); + the_attr = &default_attr; + } + /* + * Now start error checking the attributes that we are going to use + */ if ( !attr->is_initialized ) return EINVAL; @@ -62,10 +76,14 @@ int pthread_rwlock_init( return EINVAL; } -/* - the_attributes.discipline = CORE_RWLOCK_AUTOMATIC_RELEASE; -*/ + /* + * Convert from POSIX attributes to Core RWLock attributes + */ + /* Currently there are no core rwlock attributes */ + /* + * Enter dispatching critical section to allocate and initialize RWLock + */ _Thread_Disable_dispatch(); /* prevents deletion */ the_rwlock = _POSIX_RWLock_Allocate(); |