pussuw commented on PR #15566: URL: https://github.com/apache/nuttx/pull/15566#issuecomment-2595114942
> > > > > > atomic_load > > > > > > > > > > > > > > > use atomic_read > > > > > > > > > > > > atomic_read requires atomic_t type, which is volatile int. Are we supposed to use atomic_t inside the kernel, even if the toolchain implements atomic_load et al. ? > > > > The atomic.h API is a bit unclear to me after the recent modifications. > > > > > > > > > The recent improvement ensure atomic api can be used on all arch even without toolchain support. > > > > > > Should we add atomic_load ? Since atomic_read does not ensure memory ordering ? > > the interface follow Linux kernel design Ok. In my case using atomic_read is OK since reading cond->wait_count does not need to be ordered, so I'll just change to atomic_read. In any case, if ever needed / wanted, atomic_load can be added very simply: ``` #define atomic_load(obj) ATOMIC_FUNC(load, 4)(obj, __ATOMIC_SEQ_CST) #define atomic_load_acquire(obj) atomic_read_acquire(obj) #define atomic64_load(obj) ATOMIC_FUNC(load, 8)(obj, __ATOMIC_SEQ_CST) #define atomic64_load_acquire(obj) atomic_read64_acquire(obj) ``` -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org