yangsong8-a1 opened a new pull request, #22557:
URL: https://github.com/apache/nuttx/pull/22557
Summary
- nxmutex_lock(), nxmutex_ticklock() and nxmutex_clocklock() now wait
with the interruptible nxsem_wait()/nxsem_tickwait()/
nxsem_clockwait() and retry when the wait is interrupted with
-EINTR or -ECANCELED, instead of failing the lock. Most callers
of nxmutex_lock() do not check the return value, so an interrupted
wait would leave the mutex unlocked and the caller running anyway.
- nxmutex_ticklock() recomputes the remaining timeout after an
interrupted wait. It uses clock() instead of the internal tree's
clock_systime_ticks(): the latter is not available to user space
in the protected build, where lib_mutex.c is also linked.
Impact
- Mutex waits can now run signal handlers while blocked, and the
lock result after a signal is the same as without: the behavior
visible to the (mostly unchecked) return value is unchanged, the
wait is simply not aborted by a signal anymore.
- Applies to every nxmutex user in flat, protected and kernel modes;
protected mode would not link with clock_systime_ticks(), hence
the clock()-based timeout recompute.
Testing
- sim:nsh (flat) with apps/testing/ostest enabled: build, boot,
"ostest" exits with status 0; master at the same base gives the
same result.
- qemu-armv8a:knsh (kernel): build.
- fvp-v8r:fvp-armv8r:pnsh (protected): build (fails without the
clock() change).
- ./tools/checkpatch.sh -c -u -m -g HEAD~1..HEAD: all checks pass.
- Not tested: real device.
--
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]