Skip to content

Commit c01d9d1

Browse files
committed
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 <[email protected]>
1 parent a594369 commit c01d9d1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.codespell-ignore-lines

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
mynewt-nimble/nimble/host/services/ans/src/ble_svc_ans.c
22
mynewt-nimble/nimble/host/services/ans/include
3+
#include "crypto/controlse/ccertificate.hxx"
4+
object = new Controlse::CCertificate(
5+
Controlse::CCertificate cert(se, settings->key_id);
6+
auto certificate = Controlse::CCertificate(

crypto/controlse/controlse_main.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,12 @@ int main(int argc, FAR char *argv[])
701701
#ifdef CONFIG_STACK_COLORATION
702702
FAR struct tcb_s *tcb;
703703
tcb = nxsched_get_tcb(getpid());
704-
fprintf(stderr, "\nStack used: %zu / %zu\n", up_check_tcbstack(tcb),
705-
tcb->adj_stack_size);
704+
if (tcb)
705+
{
706+
fprintf(stderr, "\nStack used: %zu / %zu\n", up_check_tcbstack(tcb),
707+
tcb->adj_stack_size);
708+
nxsched_put_tcb(tcb);
709+
}
706710
#else
707711
fprintf(stderr, "\nStack used: unknown"
708712
" (STACK_COLORATION must be enabled)\n");

0 commit comments

Comments
 (0)