Libatomic provides arch-independant API for the low-level atomic implementation. Library supports x86 (both i386 and x86_64), PPC64, Sparc64 (v9 and higher) and with modern gcc (version higher than 4.1.0) and its __sync extensions all its supported platforms.
Library exports platform-dependant atomic_t type and number of API to work with, namely
void atomic_set(atomic_t *a, int val) int atomic_add(atomic_t *a, int val); int atomic_sub(atomic_t *a, int val); int atomic_inc(atomic_t *a); int atomic_dec(atomic_t *a); int atomic_dec_and_test(atomic_t *a);
All functions perform atomic operation and return new value of the atomic counter. atomic_dec_and_test() returns true if after decrement counter reached zero.
Library configuration automatically performs architecture detection and selection for the proper low-level atomic implementation. It is easily extensible with new platform-dependant code (both inline and usual asm or C if needed).
Recent comments
1 day 5 hours ago
1 day 5 hours ago
1 week 2 days ago
1 week 2 days ago
1 week 4 days ago
1 week 4 days ago
1 week 5 days ago
2 weeks 1 day ago
2 weeks 1 day ago
2 weeks 3 days ago