diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-05 11:48:57 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-07 17:06:43 +0200 |
commit | 2d2352bab92c51c2fd857b9555242545bd08c95e (patch) | |
tree | de11a05e5b361a161e93c98866aa704ed24ed3ae /cpukit/posix/src/condwaitsupp.c | |
parent | score: Add _Objects_Put_for_get_isr_disable() (diff) | |
download | rtems-2d2352bab92c51c2fd857b9555242545bd08c95e.tar.bz2 |
score: Add and use _Objects_Put()
Add and use _Objects_Put_without_thread_dispatch(). These two functions
pair with the _Objects_Get() function. This helps to introduce object
specific SMP locks to avoid lock contention.
Diffstat (limited to 'cpukit/posix/src/condwaitsupp.c')
-rw-r--r-- | cpukit/posix/src/condwaitsupp.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/cpukit/posix/src/condwaitsupp.c b/cpukit/posix/src/condwaitsupp.c index 91bdc32a0c..53a0830ff7 100644 --- a/cpukit/posix/src/condwaitsupp.c +++ b/cpukit/posix/src/condwaitsupp.c @@ -37,15 +37,17 @@ int _POSIX_Condition_variables_Wait_support( ) { register POSIX_Condition_variables_Control *the_cond; + POSIX_Mutex_Control *the_mutex; Objects_Locations location; int status; int mutex_status; - if ( !_POSIX_Mutex_Get( mutex, &location ) ) { + the_mutex = _POSIX_Mutex_Get( mutex, &location ); + if ( !the_mutex ) { return EINVAL; } - _Thread_Unnest_dispatch(); + _Objects_Put_without_thread_dispatch( &the_mutex->Object ); the_cond = _POSIX_Condition_variables_Get( cond, &location ); switch ( location ) { @@ -53,14 +55,14 @@ int _POSIX_Condition_variables_Wait_support( case OBJECTS_LOCAL: if ( the_cond->Mutex && ( the_cond->Mutex != *mutex ) ) { - _Thread_Enable_dispatch(); + _Objects_Put( &the_cond->Object ); return EINVAL; } (void) pthread_mutex_unlock( mutex ); /* XXX ignore this for now since behavior is undefined if ( mutex_status ) { - _Thread_Enable_dispatch(); + _Objects_Put( &the_cond->Object ); return EINVAL; } */ @@ -75,7 +77,7 @@ int _POSIX_Condition_variables_Wait_support( _Thread_queue_Enqueue( &the_cond->Wait_queue, timeout ); - _Thread_Enable_dispatch(); + _Objects_Put( &the_cond->Object ); /* * Switch ourself out because we blocked as a result of the @@ -94,7 +96,7 @@ int _POSIX_Condition_variables_Wait_support( status = 0; } else { - _Thread_Enable_dispatch(); + _Objects_Put( &the_cond->Object ); status = ETIMEDOUT; } |