From bae22c6d4ba9d0a23ad16159b105964ca8813f0d Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 16 Jan 2018 15:19:45 +0000 Subject: [PATCH] Fixed bug #911. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11295 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/oslib/include/chmempools.h | 9 ++++++++- readme.txt | 2 ++ release_note_next.txt | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/os/common/oslib/include/chmempools.h b/os/common/oslib/include/chmempools.h index 5c7666f4e..e2bd4277e 100644 --- a/os/common/oslib/include/chmempools.h +++ b/os/common/oslib/include/chmempools.h @@ -304,8 +304,15 @@ static inline void chGuardedPoolAddI(guarded_memory_pool_t *gmp, void *objp) { * @iclass */ static inline void *chGuardedPoolAllocI(guarded_memory_pool_t *gmp) { + void *p; - return chPoolAllocI(&gmp->pool); + p = chPoolAllocI(&gmp->pool); + if (p != NULL) { + chSemFastWaitI(&gmp->sem); + chDbgAssert(chSemGetCounterI(&gmp->sem) >= (cnt_t)0, + "semaphore out of sync"); + } + return p; } #endif /* CH_CFG_USE_SEMAPHORES == TRUE */ diff --git a/readme.txt b/readme.txt index fa5e5b1fb..fa1a6cf1a 100644 --- a/readme.txt +++ b/readme.txt @@ -166,6 +166,8 @@ dependencies and configuration directories. This makes possible to have multiple non-conflicting makefiles in the same project. Updated the various platform.mk implementing "smart build" mode. +- LIB: Fixed inner semaphore not updated in chGuardedPoolAllocI() function + (bug #911). - HAL: Fixed chprintf float support for 0 precision (bug #910)(backported to 17.6.4 and 16.1.10). - RT: Fixed compile error with assertions enabled and dynamic extensions diff --git a/release_note_next.txt b/release_note_next.txt index 6b402943f..2dc4cb2d9 100644 --- a/release_note_next.txt +++ b/release_note_next.txt @@ -45,6 +45,7 @@ received a series of important improvements, new features have been added. exchange complex objects between threads/ISRs. It is based on a mailbox and a guarded memory pool. - Added alignment handling to memory pools. +- Added a new chGuardedPoolAllocI() API to the guarded memory pools. *** What's new in RT 5.0.0 ***