wangzhi16 opened a new pull request, #18070:
URL: https://github.com/apache/nuttx/pull/18070
## Summary
This fix addresses a critical race condition in multi-core SIGCONT
handling where the signal is received but not executed, leaving the
target thread in stopped state indefinitely.
## Root Cause
In sig_dispatch(), the thread is only added to readytorun queue if:
1. SIGCONT is dispatched
2. Thread is in TSTATE_TASK_STOPPED state
A race condition occurs when:
- CPU0 checks thread state (not stopped) and decides not to add to queue
- CPU1 calls sched_suspend() and sets state to STOPPED
- Result: Thread is stopped but never added to readytorun queue
## Solution
1. Introduced SIGCONT execution flag to track if action was executed
2. Expanded critical section in nxsig_stop_task() to prevent concurrent
SIGCONT logic execution during state transitions
## Testing
Verified with 1000+ SIGSTOP/SIGCONT cycles on multi-core systems with
no thread stalls or race conditions detected.
Signed-off-by: wangzhi16 <[email protected]>
--
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]