anchao commented on code in PR #14578:
URL: https://github.com/apache/nuttx/pull/14578#discussion_r1847490565
##########
sched/sched/sched_lock.c:
##########
@@ -46,6 +46,30 @@
* Public Functions
****************************************************************************/
+/****************************************************************************
+ * Name: sched_lock_wo_note
+ *
+ * Description:
+ * This function disables context switching.
+ * It does not perform instrumentation logic.
+ *
+ ****************************************************************************/
+
+bool sched_lock_wo_note(void)
+{
+ FAR struct tcb_s *tcb;
+
+ if (OSINIT_TASK_READY() && !up_interrupt_context())
+ {
+ tcb = this_task();
+ tcb->lockcount++;
+
+ return tcb->lockcount == 1 ? true : false;
Review Comment:
race condition, lock count should use atomic
##########
sched/sched/sched_lock.c:
##########
@@ -46,6 +46,30 @@
* Public Functions
****************************************************************************/
+/****************************************************************************
+ * Name: sched_lock_wo_note
+ *
+ * Description:
+ * This function disables context switching.
+ * It does not perform instrumentation logic.
+ *
+ ****************************************************************************/
+
+bool sched_lock_wo_note(void)
+{
+ FAR struct tcb_s *tcb;
+
+ if (OSINIT_TASK_READY() && !up_interrupt_context())
Review Comment:
why not replace to check `tcb == NULL` here?
--
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]