diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-04-23 10:01:22 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-05-19 12:00:45 +0200 |
commit | 02c4c441a51b43b55608893efa4a80a62bb9d4d5 (patch) | |
tree | 709655b1c53afc3ff981890989a5290d1c400ad2 /cpukit/posix | |
parent | score: Generalize _Event_Timeout() (diff) | |
download | rtems-02c4c441a51b43b55608893efa4a80a62bb9d4d5.tar.bz2 |
score: Add Thread_queue_Control::Lock
Move the complete thread queue enqueue procedure into
_Thread_queue_Enqueue_critical(). It is possible to use the thread
queue lock to protect state of the object embedding the thread queue.
This enables per object fine grained locking in the future.
Delete _Thread_queue_Enter_critical_section().
Update #2273.
Diffstat (limited to '')
-rw-r--r-- | cpukit/posix/include/rtems/posix/barrierimpl.h | 1 | ||||
-rw-r--r-- | cpukit/posix/include/rtems/posix/condimpl.h | 2 | ||||
-rw-r--r-- | cpukit/posix/include/rtems/posix/muteximpl.h | 1 | ||||
-rw-r--r-- | cpukit/posix/include/rtems/posix/psignalimpl.h | 8 | ||||
-rw-r--r-- | cpukit/posix/include/rtems/posix/rwlockimpl.h | 1 | ||||
-rw-r--r-- | cpukit/posix/include/rtems/posix/semaphoreimpl.h | 1 | ||||
-rw-r--r-- | cpukit/posix/src/condwaitsupp.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/psignal.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/pthread.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/pthreadjoin.c | 1 | ||||
-rw-r--r-- | cpukit/posix/src/sigtimedwait.c | 8 |
11 files changed, 14 insertions, 15 deletions
diff --git a/cpukit/posix/include/rtems/posix/barrierimpl.h b/cpukit/posix/include/rtems/posix/barrierimpl.h index 240abad45d..22be1c0d6e 100644 --- a/cpukit/posix/include/rtems/posix/barrierimpl.h +++ b/cpukit/posix/include/rtems/posix/barrierimpl.h @@ -80,6 +80,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Barrier_Free ( POSIX_Barrier_Control *the_barrier ) { + _CORE_barrier_Destroy( &the_barrier->Barrier ); _Objects_Free( &_POSIX_Barrier_Information, &the_barrier->Object ); } diff --git a/cpukit/posix/include/rtems/posix/condimpl.h b/cpukit/posix/include/rtems/posix/condimpl.h index 435127ee3c..7def0f852a 100644 --- a/cpukit/posix/include/rtems/posix/condimpl.h +++ b/cpukit/posix/include/rtems/posix/condimpl.h @@ -19,6 +19,7 @@ #include <rtems/posix/cond.h> #include <rtems/score/objectimpl.h> +#include <rtems/score/threadqimpl.h> #include <rtems/score/watchdog.h> #ifdef __cplusplus @@ -72,6 +73,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free ( POSIX_Condition_variables_Control *the_condition_variable ) { + _Thread_queue_Destroy( &the_condition_variable->Wait_queue ); _Objects_Free( &_POSIX_Condition_variables_Information, &the_condition_variable->Object diff --git a/cpukit/posix/include/rtems/posix/muteximpl.h b/cpukit/posix/include/rtems/posix/muteximpl.h index 821961c0f4..f4c6c686aa 100644 --- a/cpukit/posix/include/rtems/posix/muteximpl.h +++ b/cpukit/posix/include/rtems/posix/muteximpl.h @@ -72,6 +72,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free( POSIX_Mutex_Control *the_mutex ) { + _CORE_mutex_Destroy( &the_mutex->Mutex ); _Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object ); } diff --git a/cpukit/posix/include/rtems/posix/psignalimpl.h b/cpukit/posix/include/rtems/posix/psignalimpl.h index 81561e2539..166705b37b 100644 --- a/cpukit/posix/include/rtems/posix/psignalimpl.h +++ b/cpukit/posix/include/rtems/posix/psignalimpl.h @@ -33,7 +33,7 @@ #include <rtems/posix/sigset.h> #include <rtems/score/apiext.h> #include <rtems/score/isrlock.h> -#include <rtems/score/threadq.h> +#include <rtems/score/threadqimpl.h> #define _States_Is_interruptible_signal( _states ) \ ( ((_states) & \ @@ -55,8 +55,6 @@ * Variables */ -extern ISR_lock_Control _POSIX_signals_Lock; - extern sigset_t _POSIX_signals_Pending; extern const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ]; @@ -79,10 +77,10 @@ extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ]; void _POSIX_signals_Manager_Initialization(void); #define _POSIX_signals_Acquire( lock_context ) \ - _ISR_lock_ISR_disable_and_acquire( &_POSIX_signals_Lock, lock_context ) + _Thread_queue_Acquire( &_POSIX_signals_Wait_queue, lock_context ) #define _POSIX_signals_Release( lock_context ) \ - _ISR_lock_Release_and_ISR_enable( &_POSIX_signals_Lock, lock_context ) + _Thread_queue_Release( &_POSIX_signals_Wait_queue, lock_context ) void _POSIX_signals_Action_handler( Thread_Control *executing, diff --git a/cpukit/posix/include/rtems/posix/rwlockimpl.h b/cpukit/posix/include/rtems/posix/rwlockimpl.h index 48e0a17366..46e33904dc 100644 --- a/cpukit/posix/include/rtems/posix/rwlockimpl.h +++ b/cpukit/posix/include/rtems/posix/rwlockimpl.h @@ -89,6 +89,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_RWLock_Free ( POSIX_RWLock_Control *the_RWLock ) { + _CORE_RWLock_Destroy( &the_RWLock->RWLock ); _Objects_Free( &_POSIX_RWLock_Information, &the_RWLock->Object ); } diff --git a/cpukit/posix/include/rtems/posix/semaphoreimpl.h b/cpukit/posix/include/rtems/posix/semaphoreimpl.h index df5e5238de..783289aa44 100644 --- a/cpukit/posix/include/rtems/posix/semaphoreimpl.h +++ b/cpukit/posix/include/rtems/posix/semaphoreimpl.h @@ -65,6 +65,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Free ( POSIX_Semaphore_Control *the_semaphore ) { + _CORE_semaphore_Destroy( &the_semaphore->Semaphore ); _Objects_Free( &_POSIX_Semaphore_Information, &the_semaphore->Object ); } diff --git a/cpukit/posix/src/condwaitsupp.c b/cpukit/posix/src/condwaitsupp.c index 1abdc426fc..8a9e23540c 100644 --- a/cpukit/posix/src/condwaitsupp.c +++ b/cpukit/posix/src/condwaitsupp.c @@ -74,10 +74,8 @@ int _POSIX_Condition_variables_Wait_support( if ( !already_timedout ) { the_cond->Mutex = *mutex; - _Thread_queue_Enter_critical_section( &the_cond->Wait_queue ); executing = _Thread_Executing; executing->Wait.return_code = 0; - executing->Wait.queue = &the_cond->Wait_queue; executing->Wait.id = *cond; _Thread_queue_Enqueue( diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c index eec4d95fb5..543b558eac 100644 --- a/cpukit/posix/src/psignal.c +++ b/cpukit/posix/src/psignal.c @@ -45,8 +45,6 @@ RTEMS_STATIC_ASSERT( /*** PROCESS WIDE STUFF ****/ -ISR_lock_Control _POSIX_signals_Lock = ISR_LOCK_INITIALIZER("POSIX signals"); - sigset_t _POSIX_signals_Pending; void _POSIX_signals_Abnormal_termination_handler( diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c index 97882bf4cb..2817891ac5 100644 --- a/cpukit/posix/src/pthread.c +++ b/cpukit/posix/src/pthread.c @@ -288,6 +288,8 @@ static void _POSIX_Threads_Terminate_extension( if ( api->schedpolicy == SCHED_SPORADIC ) _Watchdog_Remove_ticks( &api->Sporadic_timer ); + _Thread_queue_Destroy( &api->Join_List ); + _Thread_Enable_dispatch(); } diff --git a/cpukit/posix/src/pthreadjoin.c b/cpukit/posix/src/pthreadjoin.c index e2b1664b0b..48fb7d58df 100644 --- a/cpukit/posix/src/pthreadjoin.c +++ b/cpukit/posix/src/pthreadjoin.c @@ -67,7 +67,6 @@ on_EINTR: _Thread_Clear_state( the_thread, STATES_WAITING_FOR_JOIN_AT_EXIT ); } else { executing->Wait.return_argument = &return_pointer; - _Thread_queue_Enter_critical_section( &api->Join_List ); _Thread_queue_Enqueue( &api->Join_List, executing, diff --git a/cpukit/posix/src/sigtimedwait.c b/cpukit/posix/src/sigtimedwait.c index 8d86ba72a9..e988761453 100644 --- a/cpukit/posix/src/sigtimedwait.c +++ b/cpukit/posix/src/sigtimedwait.c @@ -152,17 +152,15 @@ int sigtimedwait( the_info->si_signo = -1; _Thread_Disable_dispatch(); - executing->Wait.queue = &_POSIX_signals_Wait_queue; executing->Wait.return_code = EINTR; executing->Wait.option = *set; executing->Wait.return_argument = the_info; - _Thread_queue_Enter_critical_section( &_POSIX_signals_Wait_queue ); - _POSIX_signals_Release( &lock_context ); - _Thread_queue_Enqueue( + _Thread_queue_Enqueue_critical( &_POSIX_signals_Wait_queue, executing, STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL, - interval + interval, + &lock_context ); _Thread_Enable_dispatch(); |