[rtems commit] score: Fix _Thread_queue_Path_release()

Sebastian Huber sebh at rtems.org
Thu Aug 4 08:36:50 UTC 2016


Module:    rtems
Branch:    master
Commit:    ca783bbe4c38f16bf98205604b364e69dbb35ee6
Changeset: http://git.rtems.org/rtems/commit/?id=ca783bbe4c38f16bf98205604b364e69dbb35ee6

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Aug  4 10:16:14 2016 +0200

score: Fix _Thread_queue_Path_release()

It is possible that the owner of the terminal link of a thread queue
path waits on a thread queue.  However, this thread queue has no owner,
e.g. a thread queue of a message queue.

---

 cpukit/score/src/threadqenqueue.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index 8f11fa2..54d3a42 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -177,19 +177,24 @@ static void _Thread_queue_Path_release( Thread_queue_Path *path )
   if ( head != node ) {
     Thread_queue_Link *link;
 
-    /* The terminal link has an owner which does not wait on a thread queue */
+    /*
+     * The terminal link may have an owner which does not wait on a thread
+     * queue.
+     */
+
     link = THREAD_QUEUE_LINK_OF_PATH_NODE( node );
-    _Assert( link->Queue_context.Wait.queue == NULL );
 
-    _Thread_Wait_release_default_critical(
-      link->owner,
-      &link->Queue_context.Lock_context
-    );
+    if ( link->Queue_context.Wait.queue == NULL ) {
+      _Thread_Wait_release_default_critical(
+        link->owner,
+        &link->Queue_context.Lock_context
+      );
 
-    node = _Chain_Previous( node );
+      node = _Chain_Previous( node );
 #if defined(RTEMS_DEBUG)
-    _Chain_Set_off_chain( &link->Path_node );
+      _Chain_Set_off_chain( &link->Path_node );
 #endif
+    }
 
     while ( head != node ) {
       /* The other links have an owner which waits on a thread queue */



More information about the vc mailing list