Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Unified Diff: base/atomicops_internals_gcc.h

Issue 10879019: Fix atomicops internal implementation using GCC intrinsics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/atomicops_internals_gcc.h
===================================================================
--- base/atomicops_internals_gcc.h (revision 152814)
+++ base/atomicops_internals_gcc.h (working copy)
@@ -17,9 +17,11 @@
Atomic32 new_value) {
Atomic32 prev_value;
do {
- prev_value = __sync_val_compare_and_swap(ptr, old_value, new_value);
- } while (prev_value != old_value);
- return old_value;
+ if (__sync_bool_compare_and_swap(ptr, old_value, new_value))
+ return old_value;
+ prev_value = *ptr;
+ } while (prev_value == old_value);
+ return prev_value;
}
inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698