api-gcc.h: fix typos in the functions atomic_add_*
PATCH 1/1 api-gcc.h: fix typos in the functions atomic_add_*
The typo in atomic_add_return() incurs tricky bugs. For example, the current atomic_dec_return() is indeed an atomic_add_return(). A similar typo appears in the function atomic_add_negative().
Signed-off-by Junchang Wang <[email protected]>
--- CodeSamples/api-pthreads/api-gcc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
CodeSamples/api-pthreads/api-gcc.h +2 -2
@@ -140,7 +140,7 @@ static __inline__ int atomic_inc_and_test(atomic_t *v)*/ static __inline__int atomic_add_negative (int i,atomic_t *v) { -return __atomic_add_fetch (&v->counter,1 , __ATOMIC_SEQ_CST) <0 ; +return __atomic_add_fetch (&v->counter, i, __ATOMIC_SEQ_CST) <0 ; }/**
@@ -152,7 +152,7 @@ static __inline__ int atomic_add_negative(int i, atomic_t *v)*/ static __inline__int atomic_add_return (int i,atomic_t *v) { -return __atomic_add_fetch (&v->counter,1 , __ATOMIC_SEQ_CST); +return __atomic_add_fetch (&v->counter, i, __ATOMIC_SEQ_CST); }static __inline__int atomic_sub_return (int i,atomic_t *v)
Signature · 1 line
2.7.4