From 24ea4a3706cc43f5830d61cb218eee3473b73fbb Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 12 Jun 2021 06:41:14 +0000 Subject: [PATCH] Untangled some conditions. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14534 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/rt/src/chthreads.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/os/rt/src/chthreads.c b/os/rt/src/chthreads.c index 65fb669dc..8c6b48591 100644 --- a/os/rt/src/chthreads.c +++ b/os/rt/src/chthreads.c @@ -526,18 +526,17 @@ void chThdExitS(msg_t msg) { #endif #if CH_CFG_USE_REGISTRY == TRUE - /* Static threads with no references are immediately removed from the - registry because there is no memory to recover.*/ -#if CH_CFG_USE_DYNAMIC == TRUE - if (unlikely((currtp->refs == (trefs_t)0) && - ((currtp->flags & CH_FLAG_MODE_MASK) == CH_FLAG_MODE_STATIC))) { - REG_REMOVE(currtp); - } -#else if (unlikely(currtp->refs == (trefs_t)0)) { +#if CH_CFG_USE_DYNAMIC == TRUE + /* Static threads are immediately removed from the registry because there + is no memory to recover.*/ + if (unlikely(((currtp->flags & CH_FLAG_MODE_MASK) == CH_FLAG_MODE_STATIC))) { + REG_REMOVE(currtp); + } +#else REG_REMOVE(currtp); - } #endif + } #endif /* Going into final state.*/