pussuw commented on code in PR #14465: URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812583298
########## sched/semaphore/semaphore.h: ########## @@ -31,10 +31,17 @@ #include <nuttx/compiler.h> #include <nuttx/semaphore.h> #include <nuttx/sched.h> +#include <nuttx/atomic.h> #include <stdint.h> #include <stdbool.h> +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define NXSEM_COUNT(s) ((FAR atomic_short *)&(s)->semcount) Review Comment: Yes but my point is, is short guaranteed to be atomic without locking ? atomic_short can be forwarded to stdatomic which can use locks to implement the read-modify-write. On some architectures only the natural datawidth can be handled atomically by the hardware. So should we use u64 as semcount for u64 architectures, u32 for u32 architectures etc? -- 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]
