Skip to content

Commit

Permalink
atomic: define helper functions in case stdatomics is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Oct 3, 2024
1 parent 0509fa1 commit c874006
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
13 changes: 7 additions & 6 deletions atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,6 @@ static __inline__ void atomic_dec(atomic_t *v)

#undef NO_ATOMIC_OPS

/************************* other ARCH ****************************/

#else

#define NO_ATOMIC_OPS

/* C11 stdatomics wrappers */
#define atomic_init(a, v) atomic_set(a, v)
#define atomic_store(a, v) atomic_set(a, v)
Expand All @@ -226,6 +220,13 @@ static __inline__ void atomic_dec(atomic_t *v)
atomic_add(v, a);\
else \
atomic_sub(-(v), a);

/************************* other ARCH ****************************/

#else

#define NO_ATOMIC_OPS

#endif
#endif /* HAVE_STDATOMIC */

Expand Down
4 changes: 0 additions & 4 deletions mem/module_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@
#ifdef SHM_EXTRA_STATS

#include <dlfcn.h>
#ifdef HAVE_STDATOMIC
#include <stdatomic.h>
#else
#include "../atomic.h"
#endif
#include <string.h>

#include "module_info.h"
Expand Down

0 comments on commit c874006

Please sign in to comment.