Print this page
5042 stop using deprecated atomic functions
@@ -22,12 +22,10 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "bge_impl.h"
/*
* Atomically decrement a counter, but only if it will remain
* strictly positive (greater than zero) afterwards. We return
@@ -47,11 +45,11 @@
do {
oldval = *count_p;
newval = oldval - n;
if (oldval <= n)
return (0); /* no resources left */
- } while (cas64(count_p, oldval, newval) != oldval);
+ } while (atomic_cas_64(count_p, oldval, newval) != oldval);
return (newval);
}
/*
@@ -65,11 +63,11 @@
/* ATOMICALLY */
do {
oldval = *count_p;
newval = oldval + n;
- } while (cas64(count_p, oldval, newval) != oldval);
+ } while (atomic_cas_64(count_p, oldval, newval) != oldval);
}
/*
* Atomically claim a slot in a descriptor ring
*/
@@ -81,11 +79,11 @@
/* ATOMICALLY */
do {
oldval = *count_p;
newval = NEXT(oldval, limit);
- } while (cas64(count_p, oldval, newval) != oldval);
+ } while (atomic_cas_64(count_p, oldval, newval) != oldval);
return (oldval);
}
/*
@@ -100,11 +98,11 @@
/* ATOMICALLY */
do {
oldval = *sp;
newval = NEXT(oldval, limit);
- } while (cas64(sp, oldval, newval) != oldval);
+ } while (atomic_cas_64(sp, oldval, newval) != oldval);
return (oldval);
}
/*
@@ -118,11 +116,11 @@
/* ATOMICALLY */
do {
oldval = *count_p;
newval = oldval - n;
- } while (cas64(count_p, oldval, newval) != oldval);
+ } while (atomic_cas_64(count_p, oldval, newval) != oldval);
}
/*
* Atomically clear bits in a 64-bit word, returning
* the value it had *before* the bits were cleared.
@@ -135,11 +133,11 @@
/* ATOMICALLY */
do {
oldval = *sp;
newval = oldval & ~bits;
- } while (cas64(sp, oldval, newval) != oldval);
+ } while (atomic_cas_64(sp, oldval, newval) != oldval);
return (oldval);
}
/*
@@ -154,9 +152,9 @@
/* ATOMICALLY */
do {
oldval = *sp;
newval = oldval << count;
- } while (cas32(sp, oldval, newval) != oldval);
+ } while (atomic_cas_32(sp, oldval, newval) != oldval);
return (oldval);
}