mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 15:00:12 +00:00
aix: add atomic support
aix has an atomic facility. add support for it. Change-Id: Iaf1305fbafe1c0d7f0d22f14babfbea382c0b32d Reviewed-on: http://gerrit.openafs.org/8076 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com> Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
This commit is contained in:
parent
320f74653c
commit
4505af8002
@ -77,6 +77,58 @@ rx_atomic_sub(rx_atomic_t *atomic, int change) {
|
|||||||
InterlockedExchangeAdd(&atomic->var, 0 - change);
|
InterlockedExchangeAdd(&atomic->var, 0 - change);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined(AFS_AIX61_ENV) || defined(AFS_USR_AIX61_ENV)
|
||||||
|
#include <sys/atomic_op.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
volatile int var;
|
||||||
|
} rx_atomic_t;
|
||||||
|
|
||||||
|
static_inline void
|
||||||
|
rx_atomic_set(rx_atomic_t *atomic, int val) {
|
||||||
|
atomic->var = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
static_inline int
|
||||||
|
rx_atomic_read(rx_atomic_t *atomic) {
|
||||||
|
return atomic->var;
|
||||||
|
}
|
||||||
|
|
||||||
|
static_inline void
|
||||||
|
rx_atomic_inc(rx_atomic_t *atomic) {
|
||||||
|
fetch_and_add(&atomic->var, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static_inline int
|
||||||
|
rx_atomic_inc_and_read(rx_atomic_t *atomic) {
|
||||||
|
return (fetch_and_add(&atomic->var, 1) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static_inline void
|
||||||
|
rx_atomic_add(rx_atomic_t *atomic, int change) {
|
||||||
|
fetch_and_add(&atomic->var, change);
|
||||||
|
}
|
||||||
|
|
||||||
|
static_inline int
|
||||||
|
rx_atomic_add_and_read(rx_atomic_t *atomic, int change) {
|
||||||
|
return (fetch_and_add(&atomic->var, change) + change);
|
||||||
|
}
|
||||||
|
|
||||||
|
static_inline void
|
||||||
|
rx_atomic_dec(rx_atomic_t *atomic) {
|
||||||
|
fetch_and_add(&atomic->var, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static_inline int
|
||||||
|
rx_atomic_dec_and_read(rx_atomic_t *atomic) {
|
||||||
|
return (fetch_and_add(&atomic->var, -1) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static_inline void
|
||||||
|
rx_atomic_sub(rx_atomic_t *atomic, int change) {
|
||||||
|
fetch_and_add(&atomic->var, -change);
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(AFS_DARWIN80_ENV) || defined(AFS_USR_DARWIN80_ENV)
|
#elif defined(AFS_DARWIN80_ENV) || defined(AFS_USR_DARWIN80_ENV)
|
||||||
|
|
||||||
#include <libkern/OSAtomic.h>
|
#include <libkern/OSAtomic.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user