1 2 /* 3 * Copyright 2006 The Android Open Source Project 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 10 #include "SkThread.h" 11 #include "SkTLS.h" 12 13 int32_t sk_atomic_inc(int32_t* addr) { 14 int32_t value = *addr; 15 *addr = value + 1; 16 return value; 17 } 18 19 int32_t sk_atomic_add(int32_t* addr, int32_t inc) { 20 int32_t value = *addr; 21 *addr = value + inc; 22 return value; 23 } 24 25 int32_t sk_atomic_dec(int32_t* addr) { 26 int32_t value = *addr; 27 *addr = value - 1; 28 return value; 29 } 30 void sk_membar_aquire__after_atomic_dec() { } 31 32 int32_t sk_atomic_conditional_inc(int32_t* addr) { 33 int32_t value = *addr; 34 if (value != 0) ++*addr; 35 return value; 36 } 37 void sk_membar_aquire__after_atomic_conditional_inc() { } 38 39 SkMutex::SkMutex() {} 40 41 SkMutex::~SkMutex() {} 42 43 #ifndef SK_USE_POSIX_THREADS 44 void SkMutex::acquire() {} 45 void SkMutex::release() {} 46 #endif 47 48 ////////////////////////////////////////////////////////////////////////// 49 50 static void* gSpecific; 51 52 void* SkTLS::PlatformGetSpecific(bool) { 53 return gSpecific; 54 } 55 56 void SkTLS::PlatformSetSpecific(void* ptr) { 57 gSpecific = ptr; 58 } 59