blob: 56bbbae3b3133758ece280fb117b202cbd7366a5 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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
reed@android.com8a1c16f2008-12-17 15:59:43 +00009
10#include "SkThread.h"
bungeman@google.com55487522012-05-14 14:09:24 +000011#include "SkTLS.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000012
reed@google.comdcbd6e32012-01-12 15:21:16 +000013int32_t sk_atomic_inc(int32_t* addr) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000014 int32_t value = *addr;
15 *addr = value + 1;
16 return value;
17}
18
reed@google.comdcbd6e32012-01-12 15:21:16 +000019int32_t sk_atomic_dec(int32_t* addr) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000020 int32_t value = *addr;
21 *addr = value - 1;
22 return value;
23}
bungeman@google.coma02bc152012-05-16 18:21:56 +000024void sk_membar_aquire__after_atomic_dec() { }
25
26int32_t sk_atomic_conditional_inc(int32_t* addr) {
27 int32_t value = *addr;
28 if (value != 0) ++*addr;
29 return value;
30}
31void sk_membar_aquire__after_atomic_conditional_inc() { }
reed@android.com8a1c16f2008-12-17 15:59:43 +000032
reed@google.comdcbd6e32012-01-12 15:21:16 +000033SkMutex::SkMutex() {}
reed@android.com8a1c16f2008-12-17 15:59:43 +000034
reed@google.comdcbd6e32012-01-12 15:21:16 +000035SkMutex::~SkMutex() {}
reed@android.com8a1c16f2008-12-17 15:59:43 +000036
bungeman@google.com55487522012-05-14 14:09:24 +000037#ifndef SK_USE_POSIX_THREADS
reed@google.comdcbd6e32012-01-12 15:21:16 +000038void SkMutex::acquire() {}
reed@google.comdcbd6e32012-01-12 15:21:16 +000039void SkMutex::release() {}
bungeman@google.com55487522012-05-14 14:09:24 +000040#endif
reed@android.com8a1c16f2008-12-17 15:59:43 +000041
reed@google.com48ca7e32012-05-07 20:23:27 +000042//////////////////////////////////////////////////////////////////////////
43
44static void* gSpecific;
45
reed@google.com331e2dc2012-05-08 21:45:03 +000046void* SkTLS::PlatformGetSpecific(bool) {
reed@google.com48ca7e32012-05-07 20:23:27 +000047 return gSpecific;
48}
49
50void SkTLS::PlatformSetSpecific(void* ptr) {
51 gSpecific = ptr;
52}