diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-08-02 11:26:56 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-08-03 13:57:30 +0200 |
commit | ff2e6c647d166fa54769f3c300855ef7f8020668 (patch) | |
tree | 2fe5ea9069fc561d1344e54e0524950aefd86e21 /cpukit/score/include/rtems/score/threadq.h | |
parent | posix: Fix for RTEMS_DEBUG (diff) | |
download | rtems-ff2e6c647d166fa54769f3c300855ef7f8020668.tar.bz2 |
score: Fix and simplify thread wait locks
There was a subtile race condition in _Thread_queue_Do_extract_locked().
It must first update the thread wait flags and then restore the default
thread wait state. In the previous implementation this could lead under
rare timing conditions to an ineffective _Thread_Wait_tranquilize()
resulting to a corrupt system state.
Update #2556.
Diffstat (limited to 'cpukit/score/include/rtems/score/threadq.h')
-rw-r--r-- | cpukit/score/include/rtems/score/threadq.h | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h index a39a031905..3c689ac974 100644 --- a/cpukit/score/include/rtems/score/threadq.h +++ b/cpukit/score/include/rtems/score/threadq.h @@ -164,27 +164,9 @@ typedef struct { Thread_queue_Gate Gate; /** - * @brief The thread queue lock in case the thread is blocked on a thread - * queue at thread wait lock acquire time. - */ - SMP_ticket_lock_Control *queue_lock; - - /** - * @brief The thread queue after thread wait lock acquire. - * - * In case the thread queue is NULL and the thread queue lock is non-NULL - * in this context, then we have a stale thread queue. This happens in - * case the thread wait default is restored while we wait on the thread - * queue lock, e.g. during a mutex ownership transfer. - * - * @see _Thread_Wait_restore_default(). + * @brief The thread queue in case the thread is blocked on a thread queue. */ Thread_queue_Queue *queue; - - /** - * @brief The thread queue operations after thread wait lock acquire. - */ - const Thread_queue_Operations *operations; } Wait; #endif } Thread_queue_Context; @@ -349,19 +331,16 @@ struct Thread_queue_Queue { /** * @brief Thread queue priority change operation. * + * @param[in] queue The actual thread queue. * @param[in] the_thread The thread. * @param[in] new_priority The new priority value. - * @param[in] prepend_it In case this is true, then the thread is prepended to - * its priority group in its scheduler instance, otherwise it is appended. - * @param[in] queue The actual thread queue. * * @see Thread_queue_Operations. */ typedef void ( *Thread_queue_Priority_change_operation )( + Thread_queue_Queue *queue, Thread_Control *the_thread, - Priority_Control new_priority, - bool prepend_it, - Thread_queue_Queue *queue + Priority_Control new_priority ); /** |