From 392c2fe70d224c4f564ebab5dcd3f0d607a546f0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 17 Mar 2010 13:04:42 +0000 Subject: Fixed bug 2971878 . git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1747 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- docs/reports/SPC563M64-80.txt | 4 ++-- os/kernel/src/chregistry.c | 35 ++++++++++++++++++++++------------- readme.txt | 15 ++++++++++----- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/docs/reports/SPC563M64-80.txt b/docs/reports/SPC563M64-80.txt index a11669746..35bbe17a6 100644 --- a/docs/reports/SPC563M64-80.txt +++ b/docs/reports/SPC563M64-80.txt @@ -92,7 +92,7 @@ Settings: SYSCLK=80, optimal wait states, prefetching enabled --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.1 (Benchmark, messages #1) ---- Score : 280180 msgs/S, 560360 ctxswc/S +--- Score : 280181 msgs/S, 560362 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.2 (Benchmark, messages #2) @@ -128,7 +128,7 @@ Settings: SYSCLK=80, optimal wait states, prefetching enabled --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.10 (Benchmark, virtual timers set/reset) ---- Score : 1093664 timers/S +--- Score : 1093672 timers/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.11 (Benchmark, semaphores wait/signal) diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 4dca52534..5ed8ace2e 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -23,6 +23,16 @@ * * @addtogroup registry * @details Threads Registry related APIs and services.
+ * The threads Threads Registry is a double linked list that holds + * all the active threads in the system.
+ * The registry is meant to be mainly a debug feature, as example + * through the registry a debugger can enumerate the active threads + * in any given moment or the shell can print the active threads and + * their state.
+ * Another possible use is for centralized threads memory management, + * terminating threads can pulse an event source and an event handler + * can perform a scansion of the registry in order to recover the + * memory.
* In order to use the threads registry the @p CH_USE_REGISTRY option * must be enabled in @p chconf.h. * @{ @@ -64,25 +74,24 @@ Thread *chRegFirstThread(void) { * @retval NULL if there is no next thread. */ Thread *chRegNextThread(Thread *tp) { + Thread *ntp; chSysLock(); + ntp = tp->p_newer; + if (ntp == (Thread *)&rlist) + ntp = NULL; #if CH_USE_DYNAMIC - chDbgAssert(tp->p_refs > 0, "chRegNextThread(), #1", - "not referenced"); - tp->p_refs--; -#endif - if (tp->p_newer != (Thread *)&rlist) { - tp = tp->p_newer; -#if CH_USE_DYNAMIC - chDbgAssert(tp->p_refs < 255, "chRegNextThread(), #2", + else { + chDbgAssert(ntp->p_refs < 255, "chRegNextThread(), #1", "too many references"); - tp->p_refs++; -#endif + ntp->p_refs++; } - else - tp = NULL; +#endif chSysUnlock(); - return tp; +#if CH_USE_DYNAMIC + chThdRelease(tp); +#endif + return ntp; } #endif /* CH_USE_REGISTRY */ diff --git a/readme.txt b/readme.txt index 8d5f68b48..bb47971e9 100644 --- a/readme.txt +++ b/readme.txt @@ -57,7 +57,14 @@ ***************************************************************************** *** 1.5.4 *** +- FIX: Fixed missing memory recovery on reference release in chRegNextThread() + (bug 2971878). - FIX: Fixed wrong thread state macro in STM32/spi_lld.c (bug 2968142). +- NEW: The port layer now can "capture" the implementation of individual + scheduler API functions in order to provide architecture-optimized + versions. This is done because further scheduler optimizations are + becoming increasingly pointless without considering architecture and + compiler related constraints. - NEW: Added support for the STM8 large memory model to the STM8 port. Now the assembler port code is totally inlined and the chcoreasm.asm file has been removed. @@ -65,11 +72,6 @@ subdirectory, this should make things easier for RIDE7 users. The normal makefile is still available of course. - NEW: New article in the documentation. Fixed an orphaned page (STM8 port). -- NEW: The port layer now can "capture" the implementation of individual - scheduler API functions in order to provide architecture-optimized - versions. This is done because further scheduler optimizations are - becoming increasingly pointless without considering architecture and - compiler related constraints. - NEW: Documentation improvements, now the description goes on top of each page, doxygen defaulted it in the middle, not exactly the best for readability. Improved many descriptions of the various subsystems. @@ -80,6 +82,9 @@ The previous implementation was probably overkill and took too much space. - CHANGE: Exiting from a chCondWaitTimeout() because a timeout now does not re-acquire the mutex, ownership is lost. +- CHANGE: The module documentation has been moved from the kernel.dox file + to the various source code files in order to make it easier to maintain + and double as source comments. *** 1.5.3 *** - FIX: Removed C99-style variables declarations (bug 2964418)(backported -- cgit v1.2.3