src/share/vm/runtime/atomic.cpp

changeset 2964
2a241e764894
parent 2314
f95d63e2154a
child 2993
7d9e451f5416
equal deleted inserted replaced
2962:ae5b2f1dcf12 2964:2a241e764894
81 volatile unsigned int* dest, unsigned int compare_value) { 81 volatile unsigned int* dest, unsigned int compare_value) {
82 assert(sizeof(unsigned int) == sizeof(jint), "more work to do"); 82 assert(sizeof(unsigned int) == sizeof(jint), "more work to do");
83 return (unsigned int)Atomic::cmpxchg((jint)exchange_value, (volatile jint*)dest, 83 return (unsigned int)Atomic::cmpxchg((jint)exchange_value, (volatile jint*)dest,
84 (jint)compare_value); 84 (jint)compare_value);
85 } 85 }
86
87 jlong Atomic::add(jlong add_value, volatile jlong* dest) {
88 jlong old = load(dest);
89 jlong new_value = old + add_value;
90 while (old != cmpxchg(new_value, dest, old)) {
91 old = load(dest);
92 new_value = old + add_value;
93 }
94 return old;
95 }

mercurial