Print this page
5042 stop using deprecated atomic functions
*** 22,33 ****
/*
* 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
--- 22,31 ----
*** 47,57 ****
do {
oldval = *count_p;
newval = oldval - n;
if (oldval <= n)
return (0); /* no resources left */
! } while (cas64(count_p, oldval, newval) != oldval);
return (newval);
}
/*
--- 45,55 ----
do {
oldval = *count_p;
newval = oldval - n;
if (oldval <= n)
return (0); /* no resources left */
! } while (atomic_cas_64(count_p, oldval, newval) != oldval);
return (newval);
}
/*
*** 65,75 ****
/* ATOMICALLY */
do {
oldval = *count_p;
newval = oldval + n;
! } while (cas64(count_p, oldval, newval) != oldval);
}
/*
* Atomically claim a slot in a descriptor ring
*/
--- 63,73 ----
/* ATOMICALLY */
do {
oldval = *count_p;
newval = oldval + n;
! } while (atomic_cas_64(count_p, oldval, newval) != oldval);
}
/*
* Atomically claim a slot in a descriptor ring
*/
*** 81,91 ****
/* ATOMICALLY */
do {
oldval = *count_p;
newval = NEXT(oldval, limit);
! } while (cas64(count_p, oldval, newval) != oldval);
return (oldval);
}
/*
--- 79,89 ----
/* ATOMICALLY */
do {
oldval = *count_p;
newval = NEXT(oldval, limit);
! } while (atomic_cas_64(count_p, oldval, newval) != oldval);
return (oldval);
}
/*
*** 100,110 ****
/* ATOMICALLY */
do {
oldval = *sp;
newval = NEXT(oldval, limit);
! } while (cas64(sp, oldval, newval) != oldval);
return (oldval);
}
/*
--- 98,108 ----
/* ATOMICALLY */
do {
oldval = *sp;
newval = NEXT(oldval, limit);
! } while (atomic_cas_64(sp, oldval, newval) != oldval);
return (oldval);
}
/*
*** 118,128 ****
/* ATOMICALLY */
do {
oldval = *count_p;
newval = oldval - n;
! } while (cas64(count_p, oldval, newval) != oldval);
}
/*
* Atomically clear bits in a 64-bit word, returning
* the value it had *before* the bits were cleared.
--- 116,126 ----
/* ATOMICALLY */
do {
oldval = *count_p;
newval = oldval - n;
! } 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,145 ****
/* ATOMICALLY */
do {
oldval = *sp;
newval = oldval & ~bits;
! } while (cas64(sp, oldval, newval) != oldval);
return (oldval);
}
/*
--- 133,143 ----
/* ATOMICALLY */
do {
oldval = *sp;
newval = oldval & ~bits;
! } while (atomic_cas_64(sp, oldval, newval) != oldval);
return (oldval);
}
/*
*** 154,162 ****
/* ATOMICALLY */
do {
oldval = *sp;
newval = oldval << count;
! } while (cas32(sp, oldval, newval) != oldval);
return (oldval);
}
--- 152,160 ----
/* ATOMICALLY */
do {
oldval = *sp;
newval = oldval << count;
! } while (atomic_cas_32(sp, oldval, newval) != oldval);
return (oldval);
}