From 19dcc896d7f88392a891fb415753d3e9c905fdf6 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Wed, 12 Feb 2025 19:16:09 +0800 Subject: [PATCH] sched/tcb: add a reference count to the TCB to prevent it from being deleted. To replace the large lock with smaller ones and reduce the large locks related to the TCB, in many scenarios, we only need to ensure that the TCB won't be released instead of locking, thus reducing the possibility of lock recursion. Signed-off-by: hujun5 --- .codespell-ignore-lines | 4 ++++ crypto/controlse/controlse_main.cxx | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.codespell-ignore-lines b/.codespell-ignore-lines index 75a07676e..4b6f55c66 100644 --- a/.codespell-ignore-lines +++ b/.codespell-ignore-lines @@ -1,2 +1,6 @@ mynewt-nimble/nimble/host/services/ans/src/ble_svc_ans.c mynewt-nimble/nimble/host/services/ans/include +#include "crypto/controlse/ccertificate.hxx" + object = new Controlse::CCertificate( + Controlse::CCertificate cert(se, settings->key_id); + auto certificate = Controlse::CCertificate( diff --git a/crypto/controlse/controlse_main.cxx b/crypto/controlse/controlse_main.cxx index 8c0f07cbc..a2b5dddef 100644 --- a/crypto/controlse/controlse_main.cxx +++ b/crypto/controlse/controlse_main.cxx @@ -701,8 +701,12 @@ int main(int argc, FAR char *argv[]) #ifdef CONFIG_STACK_COLORATION FAR struct tcb_s *tcb; tcb = nxsched_get_tcb(getpid()); - fprintf(stderr, "\nStack used: %zu / %zu\n", up_check_tcbstack(tcb), - tcb->adj_stack_size); + if (tcb != NULL) + { + fprintf(stderr, "\nStack used: %zu / %zu\n", up_check_tcbstack(tcb), + tcb->adj_stack_size); + nxsched_put_tcb(tcb); + } #else fprintf(stderr, "\nStack used: unknown" " (STACK_COLORATION must be enabled)\n");