summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-08-11 08:32:49 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-08-11 11:13:36 +0200
commitfef3ea9e87c01f7720a54d966f7c10fb85deea23 (patch)
tree5593c3ff97aa134c314d7df9cf8be743c60eb934 /cpukit/score/include/rtems/score
parentlibrtems++: Remove from RTEMS. (diff)
downloadrtems-fef3ea9e87c01f7720a54d966f7c10fb85deea23.tar.bz2
score: Add _Thread_queue_Surrender()
Add _Thread_queue_Surrender() to unify the mutex surrender procedures which involve a thread queue operation.
Diffstat (limited to 'cpukit/score/include/rtems/score')
-rw-r--r--cpukit/score/include/rtems/score/coremuteximpl.h16
-rw-r--r--cpukit/score/include/rtems/score/threadqimpl.h27
2 files changed, 32 insertions, 11 deletions
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index f48524a7b6..ce53b23bc7 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -114,14 +114,6 @@ Status_Control _CORE_mutex_Seize_no_protocol_slow(
Thread_queue_Context *queue_context
);
-Status_Control _CORE_mutex_Surrender_slow(
- CORE_mutex_Control *the_mutex,
- Thread_Control *executing,
- Thread_queue_Heads *heads,
- bool keep_priority,
- Thread_queue_Context *queue_context
-);
-
RTEMS_INLINE_ROUTINE void _CORE_mutex_Set_owner(
CORE_mutex_Control *the_mutex,
Thread_Control *owner
@@ -262,13 +254,15 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_recursive_mutex_Surrender(
return STATUS_SUCCESSFUL;
}
- return _CORE_mutex_Surrender_slow(
- &the_mutex->Mutex,
- executing,
+ _Thread_queue_Surrender(
+ &the_mutex->Mutex.Wait_queue.Queue,
+ CORE_MUTEX_TQ_PRIORITY_INHERIT_OPERATIONS,
heads,
+ executing,
keep_priority,
queue_context
);
+ return STATUS_SUCCESSFUL;
}
RTEMS_INLINE_ROUTINE Status_Control _CORE_recursive_mutex_Seize_no_protocol(
diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h
index 75ef4dd87e..8137800841 100644
--- a/cpukit/score/include/rtems/score/threadqimpl.h
+++ b/cpukit/score/include/rtems/score/threadqimpl.h
@@ -711,6 +711,33 @@ void _Thread_queue_Extract_with_proxy(
Thread_Control *the_thread
);
+/**
+ * @brief Surrenders the thread queue previously owned by the thread to the
+ * first enqueued thread if it exists.
+ *
+ * The owner of the thread queue must be set to NULL by the caller.
+ *
+ * This function releases the thread queue lock. In addition it performs a
+ * thread dispatch if necessary.
+ *
+ * @param[in] queue The actual thread queue.
+ * @param[in] operations The thread queue operations.
+ * @param[in] heads The thread queue heads.
+ * @param[in] previous_owner The previous owner thread surrendering the thread
+ * queue.
+ * @param[in] keep_priority Indicates if the previous owner thread should keep
+ * its current priority.
+ * @param[in] queue_context The thread queue context of the lock acquire.
+ */
+void _Thread_queue_Surrender(
+ Thread_queue_Queue *queue,
+ const Thread_queue_Operations *operations,
+ Thread_queue_Heads *heads,
+ Thread_Control *previous_owner,
+ bool keep_priority,
+ Thread_queue_Context *queue_context
+);
+
RTEMS_INLINE_ROUTINE bool _Thread_queue_Is_empty(
const Thread_queue_Queue *queue
)