epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 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 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 9 | |
| 10 | #include "SkThread.h" |
bungeman@google.com | 5548752 | 2012-05-14 14:09:24 +0000 | [diff] [blame^] | 11 | #include "SkTLS.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 12 | |
reed@google.com | dcbd6e3 | 2012-01-12 15:21:16 +0000 | [diff] [blame] | 13 | int32_t sk_atomic_inc(int32_t* addr) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 14 | int32_t value = *addr; |
| 15 | *addr = value + 1; |
| 16 | return value; |
| 17 | } |
| 18 | |
reed@google.com | dcbd6e3 | 2012-01-12 15:21:16 +0000 | [diff] [blame] | 19 | int32_t sk_atomic_dec(int32_t* addr) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 20 | int32_t value = *addr; |
| 21 | *addr = value - 1; |
| 22 | return value; |
| 23 | } |
| 24 | |
reed@google.com | dcbd6e3 | 2012-01-12 15:21:16 +0000 | [diff] [blame] | 25 | SkMutex::SkMutex() {} |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 26 | |
reed@google.com | dcbd6e3 | 2012-01-12 15:21:16 +0000 | [diff] [blame] | 27 | SkMutex::~SkMutex() {} |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 28 | |
bungeman@google.com | 5548752 | 2012-05-14 14:09:24 +0000 | [diff] [blame^] | 29 | #ifndef SK_USE_POSIX_THREADS |
reed@google.com | dcbd6e3 | 2012-01-12 15:21:16 +0000 | [diff] [blame] | 30 | void SkMutex::acquire() {} |
reed@google.com | dcbd6e3 | 2012-01-12 15:21:16 +0000 | [diff] [blame] | 31 | void SkMutex::release() {} |
bungeman@google.com | 5548752 | 2012-05-14 14:09:24 +0000 | [diff] [blame^] | 32 | #endif |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 33 | |
reed@google.com | 48ca7e3 | 2012-05-07 20:23:27 +0000 | [diff] [blame] | 34 | ////////////////////////////////////////////////////////////////////////// |
| 35 | |
| 36 | static void* gSpecific; |
| 37 | |
reed@google.com | 331e2dc | 2012-05-08 21:45:03 +0000 | [diff] [blame] | 38 | void* SkTLS::PlatformGetSpecific(bool) { |
reed@google.com | 48ca7e3 | 2012-05-07 20:23:27 +0000 | [diff] [blame] | 39 | return gSpecific; |
| 40 | } |
| 41 | |
| 42 | void SkTLS::PlatformSetSpecific(void* ptr) { |
| 43 | gSpecific = ptr; |
| 44 | } |