<div dir="ltr"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 5, 2021 at 6:37 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This fixes a missing decrement of the number of waiting threads during a<br>
barrier wait timeout.<br>
<br>
Close #4230.<br></blockquote><div><div dir="ltr">Is this bug a problem that should be fixed on any open branch(es)?</div></div><div> </div><div>Otherwise, the 3 patches look good.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
 cpukit/include/rtems/score/corebarrierimpl.h |  4 ++-<br>
 cpukit/score/src/corebarrierrelease.c        |  1 -<br>
 cpukit/score/src/corebarrierwait.c           | 30 ++++++++++++++++++++<br>
 3 files changed, 33 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/cpukit/include/rtems/score/corebarrierimpl.h b/cpukit/include/rtems/score/corebarrierimpl.h<br>
index c2dfea8f9b..2317d748c1 100644<br>
--- a/cpukit/include/rtems/score/corebarrierimpl.h<br>
+++ b/cpukit/include/rtems/score/corebarrierimpl.h<br>
@@ -33,7 +33,9 @@ extern "C" {<br>
  * @{<br>
  */<br>
<br>
-#define CORE_BARRIER_TQ_OPERATIONS &_Thread_queue_Operations_FIFO<br>
+extern const Thread_queue_Operations _CORE_barrier_Thread_queue_operations;<br>
+<br>
+#define CORE_BARRIER_TQ_OPERATIONS &_CORE_barrier_Thread_queue_operations<br>
<br>
 /**<br>
  *  @brief Initializes the core barrier.<br>
diff --git a/cpukit/score/src/corebarrierrelease.c b/cpukit/score/src/corebarrierrelease.c<br>
index 5d510107d6..1f03b24bac 100644<br>
--- a/cpukit/score/src/corebarrierrelease.c<br>
+++ b/cpukit/score/src/corebarrierrelease.c<br>
@@ -28,7 +28,6 @@ uint32_t _CORE_barrier_Do_flush(<br>
   Thread_queue_Context      *queue_context<br>
 )<br>
 {<br>
-  the_barrier->number_of_waiting_threads = 0;<br>
   return _Thread_queue_Flush_critical(<br>
     &the_barrier->Wait_queue.Queue,<br>
     CORE_BARRIER_TQ_OPERATIONS,<br>
diff --git a/cpukit/score/src/corebarrierwait.c b/cpukit/score/src/corebarrierwait.c<br>
index 3da9b05953..7651e20737 100644<br>
--- a/cpukit/score/src/corebarrierwait.c<br>
+++ b/cpukit/score/src/corebarrierwait.c<br>
@@ -23,6 +23,36 @@<br>
 #include <rtems/score/corebarrierimpl.h><br>
 #include <rtems/score/statesimpl.h><br>
 #include <rtems/score/threadimpl.h><br>
+#include <rtems/score/threadqops.h><br>
+<br>
+static void _CORE_barrier_Thread_queue_extract(<br>
+  Thread_queue_Queue   *queue,<br>
+  Thread_Control       *the_thread,<br>
+  Thread_queue_Context *queue_context<br>
+)<br>
+{<br>
+  CORE_barrier_Control *the_barrier;<br>
+<br>
+  the_barrier = RTEMS_CONTAINER_OF(<br>
+    queue,<br>
+    CORE_barrier_Control,<br>
+    Wait_queue.Queue<br>
+  );<br>
+  --the_barrier->number_of_waiting_threads;<br>
+  _Thread_queue_FIFO_extract(<br>
+    &the_barrier->Wait_queue.Queue,<br>
+    the_thread,<br>
+    queue_context<br>
+  );<br>
+}<br>
+<br>
+const Thread_queue_Operations _CORE_barrier_Thread_queue_operations = {<br>
+  .priority_actions = _Thread_queue_Do_nothing_priority_actions,<br>
+  .enqueue = _Thread_queue_FIFO_enqueue,<br>
+  .extract = _CORE_barrier_Thread_queue_extract,<br>
+  .surrender = _Thread_queue_FIFO_surrender,<br>
+  .first = _Thread_queue_FIFO_first<br>
+};<br>
<br>
 Status_Control _CORE_barrier_Seize(<br>
   CORE_barrier_Control *the_barrier,<br>
-- <br>
2.26.2<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>