[rtems commit] score: Check thread resource count in timer server

Sebastian Huber sebh at rtems.org
Thu Nov 16 06:45:43 UTC 2017


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov 16 07:17:05 2017 +0100

score: Check thread resource count in timer server

The watchdog routines invoked by the timer server may use mutexes for
synchronization.  Ensure that the resource count of the timer server is
zero after each watchdog routine invocation.  This helps to detect
broken watchdog routines.

---

 cpukit/rtems/src/timerserver.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/cpukit/rtems/src/timerserver.c b/cpukit/rtems/src/timerserver.c
index dfdba8c..894d50e 100644
--- a/cpukit/rtems/src/timerserver.c
+++ b/cpukit/rtems/src/timerserver.c
@@ -15,7 +15,7 @@
 /*  COPYRIGHT (c) 1989-2008.
  *  On-Line Applications Research Corporation (OAR).
  *
- *  Copyright (c) 2009, 2016 embedded brains GmbH.
+ *  Copyright (c) 2009, 2017 embedded brains GmbH.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -92,6 +92,9 @@ static rtems_task _Timer_server_Body(
 )
 {
   Timer_server_Control *ts = (Timer_server_Control *) arg;
+#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
+  Thread_Control *executing = _Thread_Get_executing();
+#endif
 
   while ( true ) {
     ISR_lock_Context  lock_context;
@@ -121,6 +124,9 @@ static rtems_task _Timer_server_Body(
       _Timer_server_Release( ts, &lock_context );
 
       ( *routine )( id, user_data );
+#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
+      _Assert( !_Thread_Owns_resources( executing ) );
+#endif
 
       _Timer_server_Acquire( ts, &lock_context );
     }



More information about the vc mailing list