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

Unified Diff: include/core/SkThread.h

Issue 377073002: Add support for 64bit atomics (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use function versions on windows Created 6 years, 5 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 | « bench/RefCntBench.cpp ('k') | src/ports/SkAtomics_sync.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkThread.h
diff --git a/include/core/SkThread.h b/include/core/SkThread.h
index 4f7f326097297d3e54af718073ccce9378f543d6..403b288f19087bcf7b48729d3d3f3a38b0af480d 100644
--- a/include/core/SkThread.h
+++ b/include/core/SkThread.h
@@ -16,22 +16,26 @@
* No additional memory barrier is required; this must act as a compiler barrier.
*/
static int32_t sk_atomic_inc(int32_t* addr);
+static int64_t sk_atomic_inc(int64_t* addr);
/** Atomically adds inc to the int referenced by addr and returns the previous value.
* No additional memory barrier is required; this must act as a compiler barrier.
*/
static int32_t sk_atomic_add(int32_t* addr, int32_t inc);
+static int64_t sk_atomic_add(int64_t* addr, int64_t inc);
/** Atomically subtracts one from the int referenced by addr and returns the previous value.
* This must act as a release (SL/S) memory barrier and as a compiler barrier.
*/
static int32_t sk_atomic_dec(int32_t* addr);
+static int64_t sk_atomic_dec(int64_t* addr);
/** Atomic compare and set.
* If *addr == before, set *addr to after and return true, otherwise return false.
* This must act as a release (SL/S) memory barrier and as a compiler barrier.
*/
static bool sk_atomic_cas(int32_t* addr, int32_t before, int32_t after);
+static bool sk_atomic_cas(int64_t* addr, int64_t before, int64_t after);
/** If sk_atomic_dec does not act as an acquire (L/SL) barrier,
* this must act as an acquire (L/SL) memory barrier and as a compiler barrier.
@@ -49,8 +53,8 @@ static void sk_membar_acquire__after_atomic_conditional_inc();
* and returns the previous value.
* No additional memory barrier is required; this must act as a compiler barrier.
*/
-static inline int32_t sk_atomic_conditional_inc(int32_t* addr) {
- int32_t prev;
+template<typename INT_TYPE> static inline INT_TYPE sk_atomic_conditional_inc(INT_TYPE* addr) {
+ INT_TYPE prev;
do {
prev = *addr;
if (0 == prev) {
« no previous file with comments | « bench/RefCntBench.cpp ('k') | src/ports/SkAtomics_sync.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698