summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-06-05 11:48:57 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-06-07 17:06:43 +0200
commit2d2352bab92c51c2fd857b9555242545bd08c95e (patch)
treede11a05e5b361a161e93c98866aa704ed24ed3ae /cpukit/posix/src
parentscore: Add _Objects_Put_for_get_isr_disable() (diff)
downloadrtems-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')
-rw-r--r--cpukit/posix/src/canceleval.c3
-rw-r--r--cpukit/posix/src/conddestroy.c4
-rw-r--r--cpukit/posix/src/condsignalsupp.c2
-rw-r--r--cpukit/posix/src/condwaitsupp.c14
-rw-r--r--cpukit/posix/src/keydelete.c2
-rw-r--r--cpukit/posix/src/keygetspecific.c2
-rw-r--r--cpukit/posix/src/keysetspecific.c2
-rw-r--r--cpukit/posix/src/mqueueclose.c2
-rw-r--r--cpukit/posix/src/mqueuegetattr.c2
-rw-r--r--cpukit/posix/src/mqueuenotify.c4
-rw-r--r--cpukit/posix/src/mqueuerecvsupp.c6
-rw-r--r--cpukit/posix/src/mqueuesendsupp.c4
-rw-r--r--cpukit/posix/src/mqueuesetattr.c2
-rw-r--r--cpukit/posix/src/mutexdestroy.c4
-rw-r--r--cpukit/posix/src/mutexgetprioceiling.c2
-rw-r--r--cpukit/posix/src/mutexinit.c2
-rw-r--r--cpukit/posix/src/mutexsetprioceiling.c2
-rw-r--r--cpukit/posix/src/mutexunlock.c2
-rw-r--r--cpukit/posix/src/pbarrierdestroy.c4
-rw-r--r--cpukit/posix/src/pbarrierwait.c2
-rw-r--r--cpukit/posix/src/prwlockdestroy.c4
-rw-r--r--cpukit/posix/src/prwlockrdlock.c2
-rw-r--r--cpukit/posix/src/prwlocktimedrdlock.c2
-rw-r--r--cpukit/posix/src/prwlocktimedwrlock.c2
-rw-r--r--cpukit/posix/src/prwlocktryrdlock.c2
-rw-r--r--cpukit/posix/src/prwlocktrywrlock.c2
-rw-r--r--cpukit/posix/src/prwlockunlock.c2
-rw-r--r--cpukit/posix/src/prwlockwrlock.c2
-rw-r--r--cpukit/posix/src/pspindestroy.c4
-rw-r--r--cpukit/posix/src/pspinlock.c2
-rw-r--r--cpukit/posix/src/pspintrylock.c2
-rw-r--r--cpukit/posix/src/pspinunlock.c2
-rw-r--r--cpukit/posix/src/pthreaddetach.c2
-rw-r--r--cpukit/posix/src/pthreadequal.c18
-rw-r--r--cpukit/posix/src/pthreadexit.c2
-rw-r--r--cpukit/posix/src/pthreadgetschedparam.c2
-rw-r--r--cpukit/posix/src/pthreadjoin.c6
-rw-r--r--cpukit/posix/src/pthreadkill.c6
-rw-r--r--cpukit/posix/src/pthreadsetschedparam.c2
-rw-r--r--cpukit/posix/src/semaphorewaitsupp.c2
-rw-r--r--cpukit/posix/src/semclose.c2
-rw-r--r--cpukit/posix/src/semdestroy.c4
-rw-r--r--cpukit/posix/src/semgetvalue.c2
-rw-r--r--cpukit/posix/src/sempost.c2
-rw-r--r--cpukit/posix/src/timercreate.c4
-rw-r--r--cpukit/posix/src/timerdelete.c2
-rw-r--r--cpukit/posix/src/timergetoverrun.c2
-rw-r--r--cpukit/posix/src/timergettime.c2
-rw-r--r--cpukit/posix/src/timersettime.c6
49 files changed, 84 insertions, 77 deletions
diff --git a/cpukit/posix/src/canceleval.c b/cpukit/posix/src/canceleval.c
index 973d2a7db1..7e4ff02eaf 100644
--- a/cpukit/posix/src/canceleval.c
+++ b/cpukit/posix/src/canceleval.c
@@ -35,9 +35,10 @@ void _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch(
if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
thread_support->cancelation_requested ) {
+ /* FIXME: This path is broken on SMP */
_Thread_Unnest_dispatch();
_POSIX_Thread_Exit( the_thread, PTHREAD_CANCELED );
} else
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_thread->Object );
}
diff --git a/cpukit/posix/src/conddestroy.c b/cpukit/posix/src/conddestroy.c
index 99f60569e2..157049c95b 100644
--- a/cpukit/posix/src/conddestroy.c
+++ b/cpukit/posix/src/conddestroy.c
@@ -46,7 +46,7 @@ int pthread_cond_destroy(
case OBJECTS_LOCAL:
if ( _Thread_queue_First( &the_cond->Wait_queue ) ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_cond->Object );
return EBUSY;
}
@@ -56,7 +56,7 @@ int pthread_cond_destroy(
);
_POSIX_Condition_variables_Free( the_cond );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_cond->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/condsignalsupp.c b/cpukit/posix/src/condsignalsupp.c
index 36bb60ebb2..376c1a51c1 100644
--- a/cpukit/posix/src/condsignalsupp.c
+++ b/cpukit/posix/src/condsignalsupp.c
@@ -55,7 +55,7 @@ int _POSIX_Condition_variables_Signal_support(
the_cond->Mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
} while ( is_broadcast && the_thread );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_cond->Object );
return 0;
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;
}
diff --git a/cpukit/posix/src/keydelete.c b/cpukit/posix/src/keydelete.c
index 5ef6261148..8f96ca36fe 100644
--- a/cpukit/posix/src/keydelete.c
+++ b/cpukit/posix/src/keydelete.c
@@ -51,7 +51,7 @@ int pthread_key_delete(
* of the application to free the memory.
*/
_POSIX_Keys_Free( the_key );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_key->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/keygetspecific.c b/cpukit/posix/src/keygetspecific.c
index debad830ae..0e8bbcdec8 100644
--- a/cpukit/posix/src/keygetspecific.c
+++ b/cpukit/posix/src/keygetspecific.c
@@ -49,7 +49,7 @@ void *pthread_getspecific(
api = _Objects_Get_API( _Thread_Executing->Object.id );
index = _Objects_Get_index( _Thread_Executing->Object.id );
key_data = (void *) the_key->Values[ api ][ index ];
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_key->Object );
return key_data;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/keysetspecific.c b/cpukit/posix/src/keysetspecific.c
index b25e44ccbf..22eb8eb643 100644
--- a/cpukit/posix/src/keysetspecific.c
+++ b/cpukit/posix/src/keysetspecific.c
@@ -49,7 +49,7 @@ int pthread_setspecific(
api = _Objects_Get_API( _Thread_Executing->Object.id );
index = _Objects_Get_index( _Thread_Executing->Object.id );
the_key->Values[ api ][ index ] = (void *) value;
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_key->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/mqueueclose.c b/cpukit/posix/src/mqueueclose.c
index 4f1bb41bd3..f4d866156e 100644
--- a/cpukit/posix/src/mqueueclose.c
+++ b/cpukit/posix/src/mqueueclose.c
@@ -78,7 +78,7 @@ int mq_close(
&_POSIX_Message_queue_Information_fds, &the_mq_fd->Object );
_POSIX_Message_queue_Free_fd( the_mq_fd );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mq_fd->Object );
return 0;
}
diff --git a/cpukit/posix/src/mqueuegetattr.c b/cpukit/posix/src/mqueuegetattr.c
index 0f250f1c2d..f4244d0700 100644
--- a/cpukit/posix/src/mqueuegetattr.c
+++ b/cpukit/posix/src/mqueuegetattr.c
@@ -74,7 +74,7 @@ int mq_getattr(
mqstat->mq_maxmsg = the_mq->Message_queue.maximum_pending_messages;
mqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mq_fd->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/mqueuenotify.c b/cpukit/posix/src/mqueuenotify.c
index 5387335c33..e2a53e9547 100644
--- a/cpukit/posix/src/mqueuenotify.c
+++ b/cpukit/posix/src/mqueuenotify.c
@@ -69,7 +69,7 @@ int mq_notify(
if ( notification ) {
if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mq_fd->Object );
rtems_set_errno_and_return_minus_one( EBUSY );
}
@@ -88,7 +88,7 @@ int mq_notify(
}
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mq_fd->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/mqueuerecvsupp.c b/cpukit/posix/src/mqueuerecvsupp.c
index 5cfce067c6..cf1698fc00 100644
--- a/cpukit/posix/src/mqueuerecvsupp.c
+++ b/cpukit/posix/src/mqueuerecvsupp.c
@@ -59,14 +59,14 @@ ssize_t _POSIX_Message_queue_Receive_support(
case OBJECTS_LOCAL:
if ( (the_mq_fd->oflag & O_ACCMODE) == O_WRONLY ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mq_fd->Object );
rtems_set_errno_and_return_minus_one( EBADF );
}
the_mq = the_mq_fd->Queue;
if ( msg_len < the_mq->Message_queue.maximum_message_size ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mq_fd->Object );
rtems_set_errno_and_return_minus_one( EMSGSIZE );
}
@@ -97,7 +97,7 @@ ssize_t _POSIX_Message_queue_Receive_support(
timeout
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mq_fd->Object );
if (msg_prio) {
*msg_prio = _POSIX_Message_queue_Priority_from_core(
_Thread_Executing->Wait.count
diff --git a/cpukit/posix/src/mqueuesendsupp.c b/cpukit/posix/src/mqueuesendsupp.c
index 1f9bf63d5a..093c42599a 100644
--- a/cpukit/posix/src/mqueuesendsupp.c
+++ b/cpukit/posix/src/mqueuesendsupp.c
@@ -77,7 +77,7 @@ int _POSIX_Message_queue_Send_support(
case OBJECTS_LOCAL:
if ( (the_mq_fd->oflag & O_ACCMODE) == O_RDONLY ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mq_fd->Object );
rtems_set_errno_and_return_minus_one( EBADF );
}
@@ -105,7 +105,7 @@ int _POSIX_Message_queue_Send_support(
timeout /* no timeout */
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mq_fd->Object );
/*
* If we had to block, then this is where the task returns
diff --git a/cpukit/posix/src/mqueuesetattr.c b/cpukit/posix/src/mqueuesetattr.c
index 2fbcd95e3f..0e16f1fc55 100644
--- a/cpukit/posix/src/mqueuesetattr.c
+++ b/cpukit/posix/src/mqueuesetattr.c
@@ -64,7 +64,7 @@ int mq_setattr(
}
the_mq_fd->oflag = mqstat->mq_flags;
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mq_fd->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/mutexdestroy.c b/cpukit/posix/src/mutexdestroy.c
index f733ce714c..27ebde0b97 100644
--- a/cpukit/posix/src/mutexdestroy.c
+++ b/cpukit/posix/src/mutexdestroy.c
@@ -49,7 +49,7 @@ int pthread_mutex_destroy(
*/
if ( _CORE_mutex_Is_locked( &the_mutex->Mutex ) ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mutex->Object );
return EBUSY;
}
@@ -58,7 +58,7 @@ int pthread_mutex_destroy(
_CORE_mutex_Flush( &the_mutex->Mutex, NULL, EINVAL );
_POSIX_Mutex_Free( the_mutex );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mutex->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/mutexgetprioceiling.c b/cpukit/posix/src/mutexgetprioceiling.c
index 8355286ebc..450a9daeba 100644
--- a/cpukit/posix/src/mutexgetprioceiling.c
+++ b/cpukit/posix/src/mutexgetprioceiling.c
@@ -53,7 +53,7 @@ int pthread_mutex_getprioceiling(
*prioceiling = _POSIX_Priority_From_core(
the_mutex->Mutex.Attributes.priority_ceiling
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mutex->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/mutexinit.c b/cpukit/posix/src/mutexinit.c
index 979e5b84b9..b955847e6e 100644
--- a/cpukit/posix/src/mutexinit.c
+++ b/cpukit/posix/src/mutexinit.c
@@ -85,7 +85,7 @@ int pthread_mutex_init(
mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
switch ( location ) {
case OBJECTS_LOCAL:
- _Thread_Enable_dispatch();
+ _Objects_Put( &mutex_in_use->Object );
return EBUSY;
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
diff --git a/cpukit/posix/src/mutexsetprioceiling.c b/cpukit/posix/src/mutexsetprioceiling.c
index 920d6fae92..e50567d561 100644
--- a/cpukit/posix/src/mutexsetprioceiling.c
+++ b/cpukit/posix/src/mutexsetprioceiling.c
@@ -80,7 +80,7 @@ int pthread_mutex_setprioceiling(
the_mutex->Object.id,
NULL
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mutex->Object );
return 0;
diff --git a/cpukit/posix/src/mutexunlock.c b/cpukit/posix/src/mutexunlock.c
index cfe8bdbeeb..3804ec6c7e 100644
--- a/cpukit/posix/src/mutexunlock.c
+++ b/cpukit/posix/src/mutexunlock.c
@@ -54,7 +54,7 @@ int pthread_mutex_unlock(
the_mutex->Object.id,
NULL
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_mutex->Object );
return _POSIX_Mutex_Translate_core_mutex_return_code( status );
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/pbarrierdestroy.c b/cpukit/posix/src/pbarrierdestroy.c
index 66f701452f..baf788e083 100644
--- a/cpukit/posix/src/pbarrierdestroy.c
+++ b/cpukit/posix/src/pbarrierdestroy.c
@@ -50,7 +50,7 @@ int pthread_barrier_destroy(
case OBJECTS_LOCAL:
if ( the_barrier->Barrier.number_of_waiting_threads != 0 ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_barrier->Object );
return EBUSY;
}
@@ -58,7 +58,7 @@ int pthread_barrier_destroy(
_POSIX_Barrier_Free( the_barrier );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_barrier->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/pbarrierwait.c b/cpukit/posix/src/pbarrierwait.c
index e941bf5d7f..e55faa8fde 100644
--- a/cpukit/posix/src/pbarrierwait.c
+++ b/cpukit/posix/src/pbarrierwait.c
@@ -55,7 +55,7 @@ int pthread_barrier_wait(
0,
NULL
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_barrier->Object );
return _POSIX_Barrier_Translate_core_barrier_return_code(
_Thread_Executing->Wait.return_code );
diff --git a/cpukit/posix/src/prwlockdestroy.c b/cpukit/posix/src/prwlockdestroy.c
index 6c99abf128..329a297f08 100644
--- a/cpukit/posix/src/prwlockdestroy.c
+++ b/cpukit/posix/src/prwlockdestroy.c
@@ -52,7 +52,7 @@ int pthread_rwlock_destroy(
* If there is at least one thread waiting, then do not delete it.
*/
if ( _Thread_queue_First( &the_rwlock->RWLock.Wait_queue ) != NULL ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_rwlock->Object );
return EBUSY;
}
@@ -64,7 +64,7 @@ int pthread_rwlock_destroy(
_POSIX_RWLock_Free( the_rwlock );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_rwlock->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/prwlockrdlock.c b/cpukit/posix/src/prwlockrdlock.c
index 24adcb451c..621a7f84a4 100644
--- a/cpukit/posix/src/prwlockrdlock.c
+++ b/cpukit/posix/src/prwlockrdlock.c
@@ -56,7 +56,7 @@ int pthread_rwlock_rdlock(
NULL
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_rwlock->Object );
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) _Thread_Executing->Wait.return_code
);
diff --git a/cpukit/posix/src/prwlocktimedrdlock.c b/cpukit/posix/src/prwlocktimedrdlock.c
index 414fec3fd3..732ba2a129 100644
--- a/cpukit/posix/src/prwlocktimedrdlock.c
+++ b/cpukit/posix/src/prwlocktimedrdlock.c
@@ -82,7 +82,7 @@ int pthread_rwlock_timedrdlock(
NULL
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_rwlock->Object );
if ( !do_wait ) {
if ( _Thread_Executing->Wait.return_code == CORE_RWLOCK_UNAVAILABLE ) {
if ( status == POSIX_ABSOLUTE_TIMEOUT_INVALID )
diff --git a/cpukit/posix/src/prwlocktimedwrlock.c b/cpukit/posix/src/prwlocktimedwrlock.c
index 84aa3a00ff..bd6232a49a 100644
--- a/cpukit/posix/src/prwlocktimedwrlock.c
+++ b/cpukit/posix/src/prwlocktimedwrlock.c
@@ -84,7 +84,7 @@ int pthread_rwlock_timedwrlock(
NULL
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_rwlock->Object );
if ( !do_wait &&
(_Thread_Executing->Wait.return_code == CORE_RWLOCK_UNAVAILABLE) ) {
if ( status == POSIX_ABSOLUTE_TIMEOUT_INVALID )
diff --git a/cpukit/posix/src/prwlocktryrdlock.c b/cpukit/posix/src/prwlocktryrdlock.c
index f58467743c..c6e2875bb5 100644
--- a/cpukit/posix/src/prwlocktryrdlock.c
+++ b/cpukit/posix/src/prwlocktryrdlock.c
@@ -61,7 +61,7 @@ int pthread_rwlock_tryrdlock(
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_rwlock->Object );
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) _Thread_Executing->Wait.return_code
);
diff --git a/cpukit/posix/src/prwlocktrywrlock.c b/cpukit/posix/src/prwlocktrywrlock.c
index 6b51d17611..26eb3e16bd 100644
--- a/cpukit/posix/src/prwlocktrywrlock.c
+++ b/cpukit/posix/src/prwlocktrywrlock.c
@@ -60,7 +60,7 @@ int pthread_rwlock_trywrlock(
NULL
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_rwlock->Object );
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) _Thread_Executing->Wait.return_code
);
diff --git a/cpukit/posix/src/prwlockunlock.c b/cpukit/posix/src/prwlockunlock.c
index d9c2f6fa75..67fca021cf 100644
--- a/cpukit/posix/src/prwlockunlock.c
+++ b/cpukit/posix/src/prwlockunlock.c
@@ -55,7 +55,7 @@ int pthread_rwlock_unlock(
case OBJECTS_LOCAL:
status = _CORE_RWLock_Release( &the_rwlock->RWLock );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_rwlock->Object );
return _POSIX_RWLock_Translate_core_RWLock_return_code( status );
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/prwlockwrlock.c b/cpukit/posix/src/prwlockwrlock.c
index 672772e6e3..8643be1f4d 100644
--- a/cpukit/posix/src/prwlockwrlock.c
+++ b/cpukit/posix/src/prwlockwrlock.c
@@ -62,7 +62,7 @@ int pthread_rwlock_wrlock(
NULL
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_rwlock->Object );
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) _Thread_Executing->Wait.return_code
);
diff --git a/cpukit/posix/src/pspindestroy.c b/cpukit/posix/src/pspindestroy.c
index f49fd47348..f7243540b6 100644
--- a/cpukit/posix/src/pspindestroy.c
+++ b/cpukit/posix/src/pspindestroy.c
@@ -50,7 +50,7 @@ int pthread_spin_destroy(
case OBJECTS_LOCAL:
if ( _CORE_spinlock_Is_busy( &the_spinlock->Spinlock ) ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_spinlock->Object );
return EBUSY;
}
@@ -58,7 +58,7 @@ int pthread_spin_destroy(
_POSIX_Spinlock_Free( the_spinlock );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_spinlock->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/pspinlock.c b/cpukit/posix/src/pspinlock.c
index 3d0aed903b..2f4bfffaa6 100644
--- a/cpukit/posix/src/pspinlock.c
+++ b/cpukit/posix/src/pspinlock.c
@@ -49,7 +49,7 @@ int pthread_spin_lock(
case OBJECTS_LOCAL:
status = _CORE_spinlock_Wait( &the_spinlock->Spinlock, true, 0 );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_spinlock->Object );
return _POSIX_Spinlock_Translate_core_spinlock_return_code( status );
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/pspintrylock.c b/cpukit/posix/src/pspintrylock.c
index 08ace6d9da..7f7c6c17e1 100644
--- a/cpukit/posix/src/pspintrylock.c
+++ b/cpukit/posix/src/pspintrylock.c
@@ -53,7 +53,7 @@ int pthread_spin_trylock(
case OBJECTS_LOCAL:
status = _CORE_spinlock_Wait( &the_spinlock->Spinlock, false, 0 );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_spinlock->Object );
return _POSIX_Spinlock_Translate_core_spinlock_return_code( status );
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/pspinunlock.c b/cpukit/posix/src/pspinunlock.c
index 8f7c5b1e96..dc43d1d1c9 100644
--- a/cpukit/posix/src/pspinunlock.c
+++ b/cpukit/posix/src/pspinunlock.c
@@ -55,7 +55,7 @@ int pthread_spin_unlock(
case OBJECTS_LOCAL:
status = _CORE_spinlock_Release( &the_spinlock->Spinlock );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_spinlock->Object );
return _POSIX_Spinlock_Translate_core_spinlock_return_code( status );
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/pthreaddetach.c b/cpukit/posix/src/pthreaddetach.c
index 824537eb8c..52a42f6b37 100644
--- a/cpukit/posix/src/pthreaddetach.c
+++ b/cpukit/posix/src/pthreaddetach.c
@@ -43,7 +43,7 @@ int pthread_detach(
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
api->detachstate = PTHREAD_CREATE_DETACHED;
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_thread->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/pthreadequal.c b/cpukit/posix/src/pthreadequal.c
index 199cc8fb9a..9b2b0282ed 100644
--- a/cpukit/posix/src/pthreadequal.c
+++ b/cpukit/posix/src/pthreadequal.c
@@ -41,8 +41,10 @@ int pthread_equal(
#ifndef RTEMS_DEBUG
return _Objects_Are_ids_equal( t1, t2 );
#else
- int status;
- Objects_Locations location;
+ int status;
+ Objects_Locations location;
+ Thread_Control *thread_1;
+ Thread_Control *thread_2;
/*
* By default this is not a match.
@@ -54,7 +56,7 @@ int pthread_equal(
* Validate the first id and return 0 if it is not valid
*/
- (void) _Thread_Get( t1, &location );
+ thread_1 = _Thread_Get( t1, &location );
switch ( location ) {
case OBJECTS_LOCAL:
@@ -63,21 +65,21 @@ int pthread_equal(
* Validate the second id and return 0 if it is not valid
*/
- (void) _Thread_Get( t2, &location );
+ thread_2 = _Thread_Get( t2, &location );
switch ( location ) {
case OBJECTS_LOCAL:
status = _Objects_Are_ids_equal( t1, t2 );
- _Thread_Unnest_dispatch();
- _Thread_Enable_dispatch();
- break;
+ _Objects_Put_without_thread_dispatch( &thread_2->Object );
+ _Objects_Put( &thread_1->Object );
+ break;
case OBJECTS_ERROR:
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
#endif
/* t1 must have been valid so exit the critical section */
- _Thread_Enable_dispatch();
+ _Objects_Put( &thread_1->Object );
/* return status == 0 */
break;
}
diff --git a/cpukit/posix/src/pthreadexit.c b/cpukit/posix/src/pthreadexit.c
index 2e995c49bc..01bcf6fbde 100644
--- a/cpukit/posix/src/pthreadexit.c
+++ b/cpukit/posix/src/pthreadexit.c
@@ -72,6 +72,7 @@ void _POSIX_Thread_Exit(
the_thread,
STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_TRANSIENT
);
+ /* FIXME: Lock order reversal */
_RTEMS_Unlock_allocator();
_Thread_Enable_dispatch();
/* now waiting for thread to arrive */
@@ -87,6 +88,7 @@ void _POSIX_Thread_Exit(
_POSIX_Threads_Free( the_thread );
+ /* FIXME: Lock order reversal */
_RTEMS_Unlock_allocator();
_Thread_Enable_dispatch();
}
diff --git a/cpukit/posix/src/pthreadgetschedparam.c b/cpukit/posix/src/pthreadgetschedparam.c
index d681f0479a..ee430715e8 100644
--- a/cpukit/posix/src/pthreadgetschedparam.c
+++ b/cpukit/posix/src/pthreadgetschedparam.c
@@ -53,7 +53,7 @@ int pthread_getschedparam(
param->sched_priority =
_POSIX_Priority_From_core( the_thread->current_priority );
}
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_thread->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/pthreadjoin.c b/cpukit/posix/src/pthreadjoin.c
index 8304aa3685..cd8c40af18 100644
--- a/cpukit/posix/src/pthreadjoin.c
+++ b/cpukit/posix/src/pthreadjoin.c
@@ -45,12 +45,12 @@ on_EINTR:
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
if ( api->detachstate == PTHREAD_CREATE_DETACHED ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_thread->Object );
return EINVAL;
}
if ( _Thread_Is_executing( the_thread ) ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_thread->Object );
return EDEADLK;
}
@@ -70,7 +70,7 @@ on_EINTR:
_Thread_queue_Enter_critical_section( &api->Join_List );
_Thread_queue_Enqueue( &api->Join_List, WATCHDOG_NO_TIMEOUT );
}
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_thread->Object );
if ( _Thread_Executing->Wait.return_code == EINTR )
goto on_EINTR;
diff --git a/cpukit/posix/src/pthreadkill.c b/cpukit/posix/src/pthreadkill.c
index e0f395070d..b9f4922fd7 100644
--- a/cpukit/posix/src/pthreadkill.c
+++ b/cpukit/posix/src/pthreadkill.c
@@ -60,7 +60,7 @@ int pthread_kill(
if ( sig ) {
if ( _POSIX_signals_Vectors[ sig ].sa_handler == SIG_IGN ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_thread->Object );
return 0;
}
@@ -71,9 +71,9 @@ int pthread_kill(
(void) _POSIX_signals_Unblock_thread( the_thread, sig, NULL );
if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
- _Thread_Dispatch_necessary = true;
+ _Thread_Dispatch_necessary = true;
}
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_thread->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
index 06216f49a1..5fcc816d86 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -98,7 +98,7 @@ int pthread_setschedparam(
break;
}
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_thread->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/semaphorewaitsupp.c b/cpukit/posix/src/semaphorewaitsupp.c
index 08a26ee16f..f3ce6003d1 100644
--- a/cpukit/posix/src/semaphorewaitsupp.c
+++ b/cpukit/posix/src/semaphorewaitsupp.c
@@ -51,7 +51,7 @@ int _POSIX_Semaphore_Wait_support(
blocking,
timeout
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_semaphore->Object );
if ( !_Thread_Executing->Wait.return_code )
return 0;
diff --git a/cpukit/posix/src/semclose.c b/cpukit/posix/src/semclose.c
index a9521bdd6b..07f75367df 100644
--- a/cpukit/posix/src/semclose.c
+++ b/cpukit/posix/src/semclose.c
@@ -45,7 +45,7 @@ int sem_close(
case OBJECTS_LOCAL:
the_semaphore->open_count -= 1;
_POSIX_Semaphore_Delete( the_semaphore );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_semaphore->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/semdestroy.c b/cpukit/posix/src/semdestroy.c
index 14ba520fa3..cef340620a 100644
--- a/cpukit/posix/src/semdestroy.c
+++ b/cpukit/posix/src/semdestroy.c
@@ -48,12 +48,12 @@ int sem_destroy(
*/
if ( the_semaphore->named == true ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_semaphore->Object );
rtems_set_errno_and_return_minus_one( EINVAL );
}
_POSIX_Semaphore_Delete( the_semaphore );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_semaphore->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/semgetvalue.c b/cpukit/posix/src/semgetvalue.c
index 8ea0bdad07..24527d16a1 100644
--- a/cpukit/posix/src/semgetvalue.c
+++ b/cpukit/posix/src/semgetvalue.c
@@ -45,7 +45,7 @@ int sem_getvalue(
case OBJECTS_LOCAL:
*sval = _CORE_semaphore_Get_count( &the_semaphore->Semaphore );
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_semaphore->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/sempost.c b/cpukit/posix/src/sempost.c
index 7ce367986f..79e5ec83ff 100644
--- a/cpukit/posix/src/sempost.c
+++ b/cpukit/posix/src/sempost.c
@@ -52,7 +52,7 @@ int sem_post(
NULL
#endif
);
- _Thread_Enable_dispatch();
+ _Objects_Put( &the_semaphore->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/timercreate.c b/cpukit/posix/src/timercreate.c
index bd52f87fe9..a8690b6699 100644
--- a/cpukit/posix/src/timercreate.c
+++ b/cpukit/posix/src/timercreate.c
@@ -72,7 +72,7 @@ int timer_create(
*/
ptimer = _POSIX_Timer_Allocate();
if ( !ptimer ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &ptimer->Object );
rtems_set_errno_and_return_minus_one( EAGAIN );
}
@@ -97,6 +97,6 @@ int timer_create(
_Objects_Open_u32(&_POSIX_Timer_Information, &ptimer->Object, 0);
*timerid = ptimer->Object.id;
- _Thread_Enable_dispatch();
+ _Objects_Put( &ptimer->Object );
return 0;
}
diff --git a/cpukit/posix/src/timerdelete.c b/cpukit/posix/src/timerdelete.c
index f8690eb2fc..e17d48b181 100644
--- a/cpukit/posix/src/timerdelete.c
+++ b/cpukit/posix/src/timerdelete.c
@@ -54,7 +54,7 @@ int timer_delete(
ptimer->state = POSIX_TIMER_STATE_FREE;
(void) _Watchdog_Remove( &ptimer->Timer );
_POSIX_Timer_Free( ptimer );
- _Thread_Enable_dispatch();
+ _Objects_Put( &ptimer->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/timergetoverrun.c b/cpukit/posix/src/timergetoverrun.c
index 23a4e6f3fe..0708db4f7d 100644
--- a/cpukit/posix/src/timergetoverrun.c
+++ b/cpukit/posix/src/timergetoverrun.c
@@ -40,7 +40,7 @@ int timer_getoverrun(
case OBJECTS_LOCAL:
overrun = ptimer->overrun;
ptimer->overrun = 0;
- _Thread_Enable_dispatch();
+ _Objects_Put( &ptimer->Object );
return overrun;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c
index 7b9de539b6..a4b0f3ae58 100644
--- a/cpukit/posix/src/timergettime.c
+++ b/cpukit/posix/src/timergettime.c
@@ -68,7 +68,7 @@ int timer_gettime(
value->it_interval = ptimer->timer_data.it_interval;
- _Thread_Enable_dispatch();
+ _Objects_Put( &ptimer->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/timersettime.c b/cpukit/posix/src/timersettime.c
index 7bdcad8bad..678266ae3c 100644
--- a/cpukit/posix/src/timersettime.c
+++ b/cpukit/posix/src/timersettime.c
@@ -95,7 +95,7 @@ int timer_settime(
/* Indicates that the timer is created and stopped */
ptimer->state = POSIX_TIMER_STATE_CREATE_STOP;
/* Returns with success */
- _Thread_Enable_dispatch();
+ _Objects_Put( &ptimer->Object );
return 0;
}
@@ -112,7 +112,7 @@ int timer_settime(
ptimer
);
if ( !activated ) {
- _Thread_Enable_dispatch();
+ _Objects_Put( &ptimer->Object );
return 0;
}
@@ -127,7 +127,7 @@ int timer_settime(
/* Indicate that the time is running */
ptimer->state = POSIX_TIMER_STATE_CREATE_RUN;
_TOD_Get( &ptimer->time );
- _Thread_Enable_dispatch();
+ _Objects_Put( &ptimer->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)