Skip to content

Commit 30b40c9

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 cfff7f5 commit 30b40c9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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)