zyfeier commented on code in PR #21774:
URL: https://github.com/apache/nuttx/pull/21774#discussion_r4738368524
##########
sched/misc/deadlock.c:
##########
@@ -90,7 +90,13 @@ static FAR struct tcb_s *deadlock_next(FAR struct tcb_s *tcb)
return NULL;
}
- return nxsched_get_tcb(holder);
+ /* The caller runs in the critical section of nxsched_foreach(), which
+ * keeps the TCB in the pid hash, so it stays valid without a reference.
+ */
+
+ tcb = nxsched_get_tcb(holder);
+ nxsched_put_tcb(tcb);
Review Comment:
Done: deadlock_next() now reads the pid hash directly — the
immediate get-then-put pair protected nothing, the caller is inside
the nxsched_foreach() critical section which keeps the TCB valid.
##########
sched/pthread/pthread_exit.c:
##########
@@ -97,10 +99,31 @@ void nx_pthread_exit(FAR void *exit_value)
_exit(EXIT_FAILURE);
}
+ flags = enter_critical_section();
+ if ((atomic_read(&tcb->shared_flags) & TCB_FLAG_EXIT_PROCESSING) != 0)
Review Comment:
Done: the atomic_or-and-test is atomic on its own, the critical
section was left over from the separate read-then-set form. Removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]