From 96cbd2c4d2ea7e138b65923a46fb77bc096a6782 Mon Sep 17 00:00:00 2001 From: "scroggo@google.com" Date: Mon, 16 Jul 2012 13:22:56 +0000 Subject: Revert "Add a method to atomic add." This reverts commit eb539cf92f487daf9567ffbbba6b6653406d43ae. BUG= TEST= Review URL: https://codereview.appspot.com/6395051 git-svn-id: http://skia.googlecode.com/svn/trunk@4615 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/ports/SkThread_none.cpp | 6 ------ src/ports/SkThread_pthread.cpp | 14 -------------- src/ports/SkThread_win.cpp | 8 +------- 3 files changed, 1 insertion(+), 27 deletions(-) (limited to 'src') diff --git a/src/ports/SkThread_none.cpp b/src/ports/SkThread_none.cpp index 1122c959d3..56bbbae3b3 100644 --- a/src/ports/SkThread_none.cpp +++ b/src/ports/SkThread_none.cpp @@ -16,12 +16,6 @@ int32_t sk_atomic_inc(int32_t* addr) { return value; } -int32_t sk_atomic_add(int32_t* addr, int32_t inc) { - int32_t value = *addr; - *addr = value + inc; - return value; -} - int32_t sk_atomic_dec(int32_t* addr) { int32_t value = *addr; *addr = value - 1; diff --git a/src/ports/SkThread_pthread.cpp b/src/ports/SkThread_pthread.cpp index a1c7b24f66..d0bb3acbad 100644 --- a/src/ports/SkThread_pthread.cpp +++ b/src/ports/SkThread_pthread.cpp @@ -35,11 +35,6 @@ int32_t sk_atomic_inc(int32_t* addr) return __sync_fetch_and_add(addr, 1); } -int32_t sk_atomic_add(int32_t* addr, int32_t value) -{ - return __sync_fetch_and_add(addr, value); -} - int32_t sk_atomic_dec(int32_t* addr) { return __sync_fetch_and_add(addr, -1); @@ -79,15 +74,6 @@ int32_t sk_atomic_inc(int32_t* addr) return value; } -int32_t sk_atomic_add(int32_t* addr, int32_t inc) -{ - SkAutoMutexAcquire ac(gAtomicMutex); - - int32_t value = *addr; - *addr = value + inc; - return value; -} - int32_t sk_atomic_dec(int32_t* addr) { SkAutoMutexAcquire ac(gAtomicMutex); diff --git a/src/ports/SkThread_win.cpp b/src/ports/SkThread_win.cpp index 7d091d2a67..e833314843 100644 --- a/src/ports/SkThread_win.cpp +++ b/src/ports/SkThread_win.cpp @@ -16,7 +16,7 @@ //intrinsic, include intrin.h and put the function in a #pragma intrinsic //directive. //The pragma appears to be unnecessary, but doesn't hurt. -#pragma intrinsic(_InterlockedIncrement, _InterlockedAdd, _InterlockedDecrement) +#pragma intrinsic(_InterlockedIncrement, _InterlockedDecrement) #pragma intrinsic(_InterlockedCompareExchange) int32_t sk_atomic_inc(int32_t* addr) { @@ -24,12 +24,6 @@ int32_t sk_atomic_inc(int32_t* addr) { return _InterlockedIncrement(reinterpret_cast(addr)) - 1; } -int32_t sk_atomic_add(int32_t* addr, int32_t inc) { - // InterlockedAdd returns the new value, we want to return the old. - LONG value = reinterpret_cast(inc); - return _InterlockedAdd(reinterpret_cast(addr), value) - value; -} - int32_t sk_atomic_dec(int32_t* addr) { return _InterlockedDecrement(reinterpret_cast(addr)) + 1; } -- cgit v1.2.3