diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-16 16:39:43 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-23 12:52:06 +0100 |
commit | 125f248231c173a038ed9fc00832e0b3d221ad43 (patch) | |
tree | 3894553badc7582b0c460aec4d34955f23ea3e81 /cpukit/score/include/rtems/score/threadq.h | |
parent | score: Robust thread dispatch (diff) | |
download | rtems-125f248231c173a038ed9fc00832e0b3d221ad43.tar.bz2 |
score: Add thread queue enqueue callout
Replace the expected thread dispatch disable level with a thread queue
enqueue callout. This enables the use of _Thread_Dispatch_direct() in
the thread queue enqueue procedure. This avoids impossible exection
paths, e.g. Per_CPU_Control::dispatch_necessary is always true.
Diffstat (limited to 'cpukit/score/include/rtems/score/threadq.h')
-rw-r--r-- | cpukit/score/include/rtems/score/threadq.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h index 084161cc4d..df03cfb96a 100644 --- a/cpukit/score/include/rtems/score/threadq.h +++ b/cpukit/score/include/rtems/score/threadq.h @@ -45,11 +45,28 @@ struct Scheduler_Node; typedef struct _Thread_Control Thread_Control; +typedef struct Thread_queue_Context Thread_queue_Context; + typedef struct Thread_queue_Queue Thread_queue_Queue; typedef struct Thread_queue_Operations Thread_queue_Operations; /** + * @brief Thread queue enqueue callout. + * + * @param[in] queue The actual thread queue. + * @param[in] the_thread The thread to enqueue. + * @param[in] queue_context The thread queue context of the lock acquire. + * + * @see _Thread_queue_Context_set_enqueue_callout(). + */ +typedef void ( *Thread_queue_Enqueue_callout )( + Thread_queue_Queue *queue, + Thread_Control *the_thread, + Thread_queue_Context *queue_context +); + +/** * @brief Thread queue deadlock callout. * * @param the_thread The thread that detected the deadlock. @@ -168,7 +185,7 @@ typedef struct { * * @see _Thread_queue_Context_initialize(). */ -typedef struct { +struct Thread_queue_Context { /** * @brief The lock context for the thread queue acquire and release * operations. @@ -176,13 +193,14 @@ typedef struct { Thread_queue_Lock_context Lock_context; /** - * @brief The expected thread dispatch disable level for - * _Thread_queue_Enqueue_critical(). + * @brief The enqueue callout for _Thread_queue_Enqueue_critical(). + * + * The callout is invoked after the release of the thread queue lock with + * thread dispatching disabled. Afterwards the thread is blocked. * - * In case the actual thread dispatch disable level is not equal to the - * expected level, then a fatal error occurs. + * @see _Thread_queue_Enqueue_do_nothing(). */ - uint32_t expected_thread_dispatch_disable_level; + Thread_queue_Enqueue_callout enqueue_callout; /** * @brief The clock discipline for the interval timeout. @@ -274,7 +292,7 @@ typedef struct { */ Thread_queue_MP_callout mp_callout; #endif -} Thread_queue_Context; +}; /** * @brief Thread priority queue. |