blob: 638d7d017dd9913c90ef159e3995da53ae98a120 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001/*
2 * Copyright 2006 The Android Open Source Project
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
reed@android.com8a1c16f2008-12-17 15:59:43 +00008#include "SkThread.h"
9
reed@google.comdcbd6e32012-01-12 15:21:16 +000010int32_t sk_atomic_inc(int32_t* addr) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000011 int32_t value = *addr;
12 *addr = value + 1;
13 return value;
14}
15
scroggo@google.com50ccb0a2012-07-16 16:51:28 +000016int32_t sk_atomic_add(int32_t* addr, int32_t inc) {
17 int32_t value = *addr;
18 *addr = value + inc;
19 return value;
20}
21
reed@google.comdcbd6e32012-01-12 15:21:16 +000022int32_t sk_atomic_dec(int32_t* addr) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000023 int32_t value = *addr;
24 *addr = value - 1;
25 return value;
26}
bungeman@google.coma02bc152012-05-16 18:21:56 +000027void sk_membar_aquire__after_atomic_dec() { }
28
29int32_t sk_atomic_conditional_inc(int32_t* addr) {
30 int32_t value = *addr;
31 if (value != 0) ++*addr;
32 return value;
33}
34void sk_membar_aquire__after_atomic_conditional_inc() { }
reed@android.com8a1c16f2008-12-17 15:59:43 +000035
reed@google.comdcbd6e32012-01-12 15:21:16 +000036SkMutex::SkMutex() {}
reed@android.com8a1c16f2008-12-17 15:59:43 +000037
reed@google.comdcbd6e32012-01-12 15:21:16 +000038SkMutex::~SkMutex() {}
reed@android.com8a1c16f2008-12-17 15:59:43 +000039
bungeman@google.com55487522012-05-14 14:09:24 +000040#ifndef SK_USE_POSIX_THREADS
reed@google.comdcbd6e32012-01-12 15:21:16 +000041void SkMutex::acquire() {}
reed@google.comdcbd6e32012-01-12 15:21:16 +000042void SkMutex::release() {}
bungeman@google.com55487522012-05-14 14:09:24 +000043#endif