summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/threadqimpl.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-31 08:08:24 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-31 09:38:07 +0100
commite366f774a76d3607ad41dc0992e787ce38df980d (patch)
tree4ba5522aaa87021c60bcaf8d162af9b521b9268c /cpukit/score/include/rtems/score/threadqimpl.h
parentscore: Fix _Thread_Initialize() (diff)
downloadrtems-e366f774a76d3607ad41dc0992e787ce38df980d.tar.bz2
score: Add _Thread_queue_Object_name
Add the special thread queue name _Thread_queue_Object_name to mark thread queues embedded in an object with identifier. Using the special thread state STATES_THREAD_QUEUE_WITH_IDENTIFIER is not reliable for this purpose since the thread wait information and thread state are protected by different SMP locks in separate critical sections. Remove STATES_THREAD_QUEUE_WITH_IDENTIFIER. Add and use _Thread_queue_Object_initialize(). Update #2858.
Diffstat (limited to '')
-rw-r--r--cpukit/score/include/rtems/score/threadqimpl.h48
1 files changed, 46 insertions, 2 deletions
diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h
index 25a3f2d9f1..574221ca9c 100644
--- a/cpukit/score/include/rtems/score/threadqimpl.h
+++ b/cpukit/score/include/rtems/score/threadqimpl.h
@@ -353,7 +353,8 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Heads_initialize(
}
RTEMS_INLINE_ROUTINE void _Thread_queue_Queue_initialize(
- Thread_queue_Queue *queue
+ Thread_queue_Queue *queue,
+ const char *name
)
{
#if defined(RTEMS_SMP)
@@ -361,6 +362,7 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Queue_initialize(
#endif
queue->heads = NULL;
queue->owner = NULL;
+ queue->name = name;
}
RTEMS_INLINE_ROUTINE void _Thread_queue_Queue_do_acquire_critical(
@@ -418,6 +420,25 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Queue_release(
_ISR_lock_ISR_enable( lock_context );
}
+/**
+ * @brief Copies the thread queue name to the specified buffer.
+ *
+ * @param[in] queue The actual thread queue.
+ * @param[in] buffer The buffer for the thread queue name copy.
+ * @param[in] buffer_size The buffer size in characters.
+ * @param[in] id The object identifier in case the thread queue is embedded in
+ * an object with identifier, otherwise it is set to 0.
+ *
+ * @retval The length of the thread queue name. May be greater than or equal
+ * to the buffer size if truncation occurred.
+ */
+size_t _Thread_queue_Queue_get_name_and_id(
+ const Thread_queue_Queue *queue,
+ char *buffer,
+ size_t buffer_size,
+ Objects_Id *id
+);
+
#if defined(RTEMS_SMP)
void _Thread_queue_Do_acquire_critical(
Thread_queue_Control *the_thread_queue,
@@ -1011,7 +1032,10 @@ size_t _Thread_queue_Flush_critical(
Thread_queue_Context *queue_context
);
-void _Thread_queue_Initialize( Thread_queue_Control *the_thread_queue );
+void _Thread_queue_Initialize(
+ Thread_queue_Control *the_thread_queue,
+ const char *name
+);
#if defined(RTEMS_SMP) && defined(RTEMS_DEBUG) && defined(RTEMS_PROFILING)
#define THREAD_QUEUE_INITIALIZER( _name ) \
@@ -1137,6 +1161,26 @@ extern const Thread_queue_Operations _Thread_queue_Operations_priority;
extern const Thread_queue_Operations _Thread_queue_Operations_priority_inherit;
+/**
+ * @brief The special thread queue name to indicated that the thread queue is
+ * embedded in an object with identifier.
+ *
+ * @see _Thread_queue_Object_initialize().
+ */
+extern const char _Thread_queue_Object_name[];
+
+/**
+ * @brief Initializes a thread queue embedded in an object with identifier.
+ *
+ * The object must have the layout specified by Thread_queue_Object. It should
+ * be ensured with the THREAD_QUEUE_OBJECT_ASSERT() static assertion.
+ *
+ * @param[in] the_thread_queue The thread queue.
+ */
+void _Thread_queue_Object_initialize(
+ Thread_queue_Control *the_thread_queue
+);
+
/**@}*/
#ifdef __cplusplus