This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 89017e9aa87ef7e36ad7ddbe84748377d694fc9e
Author: Marco Casaroli <[email protected]>
AuthorDate: Thu Oct 22 09:23:32 2026 +0200

    Documentation/standards: Describe how the spin locks work.
    
    Say that pthread_spin_*() need no system call, which atomic operations
    CONFIG_PTHREAD_SPINLOCKS needs outside a flat build, and that a mutex is
    the better choice, except on SMP with very short critical sections.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 Documentation/standards/posix.rst | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/standards/posix.rst 
b/Documentation/standards/posix.rst
index 2d6988876c7..1a4ac61f7bc 100644
--- a/Documentation/standards/posix.rst
+++ b/Documentation/standards/posix.rst
@@ -3050,7 +3050,12 @@ Depends on ``CONFIG_BUILD_KERNEL``.
 _POSIX_SPIN_LOCKS
 -----------------
 
-Depends on ``CONFIG_PTHREAD_SPINLOCKS``.
+Depends on ``CONFIG_PTHREAD_SPINLOCKS``.  A spin lock is an atomic
+variable in the memory of the program: the functions need no system call,
+also in protected and kernel builds.  Outside a flat build, the option
+needs atomic operations that work in user mode
+(``CONFIG_LIBC_ATOMIC_TOOLCHAIN`` or ``CONFIG_LIBC_ATOMIC_ARCH``).  Prefer
+a mutex: a spin lock only helps on SMP, with very short critical sections.
 
 +--------------------------------+---------+
 | API                            | Support |

Reply via email to