blob: a948a5410c1fa930c01739a34faf6f9251fa7e5b [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}
24
reed@google.comdcbd6e32012-01-12 15:21:16 +000025SkMutex::SkMutex() {}
reed@android.com8a1c16f2008-12-17 15:59:43 +000026
reed@google.comdcbd6e32012-01-12 15:21:16 +000027SkMutex::~SkMutex() {}
reed@android.com8a1c16f2008-12-17 15:59:43 +000028
bungeman@google.com55487522012-05-14 14:09:24 +000029#ifndef SK_USE_POSIX_THREADS
reed@google.comdcbd6e32012-01-12 15:21:16 +000030void SkMutex::acquire() {}
reed@google.comdcbd6e32012-01-12 15:21:16 +000031void SkMutex::release() {}
bungeman@google.com55487522012-05-14 14:09:24 +000032#endif
reed@android.com8a1c16f2008-12-17 15:59:43 +000033
reed@google.com48ca7e32012-05-07 20:23:27 +000034//////////////////////////////////////////////////////////////////////////
35
36static void* gSpecific;
37
reed@google.com331e2dc2012-05-08 21:45:03 +000038void* SkTLS::PlatformGetSpecific(bool) {
reed@google.com48ca7e32012-05-07 20:23:27 +000039 return gSpecific;
40}
41
42void SkTLS::PlatformSetSpecific(void* ptr) {
43 gSpecific = ptr;
44}