mirror of
https://github.com/ceph/ceph
synced 2025-01-02 00:52:22 +00:00
atomic: add and sub return their result
Signed-off-by: Casey Bodley <casey@linuxbox.com> Signed-off-by: Matt Benjamin <matt@cohortfs.com>
This commit is contained in:
parent
0f6b9f2816
commit
a39cbe2b6f
@ -100,12 +100,12 @@ namespace ceph {
|
||||
AO_t dec() {
|
||||
return AO_fetch_and_sub1_write(&val) - 1;
|
||||
}
|
||||
void add(AO_t add_me) {
|
||||
AO_fetch_and_add(&val, add_me);
|
||||
AO_t add(AO_t add_me) {
|
||||
return AO_fetch_and_add(&val, add_me) + add_me;
|
||||
}
|
||||
void sub(AO_t sub_me) {
|
||||
AO_t sub(AO_t sub_me) {
|
||||
AO_t negsub = 0 - sub_me;
|
||||
AO_fetch_and_add_write(&val, (AO_t)negsub);
|
||||
return AO_fetch_and_add_write(&val, negsub) + negsub;
|
||||
}
|
||||
AO_t read() const {
|
||||
// cast away const on the pointer. this is only needed to build
|
||||
|
Loading…
Reference in New Issue
Block a user