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 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2025-02-12 19:16:09 +08:00 committed by Alan C. Assis
parent b72f7997a3
commit 19dcc896d7
2 changed files with 10 additions and 2 deletions

View file

@ -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(

View file

@ -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");