Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: src/ports/SkMutex_pthread.h

Issue 847533002: Can't include SkTypes.h from ports/ (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkMutex_pthread_DEFINED 8 #ifndef SkMutex_pthread_DEFINED
9 #define SkMutex_pthread_DEFINED 9 #define SkMutex_pthread_DEFINED
10 10
11 /** Posix pthread_mutex based mutex. */ 11 /** Posix pthread_mutex based mutex. */
12 12
13 #include "SkTypes.h"
14 #include <errno.h> 13 #include <errno.h>
15 #include <pthread.h> 14 #include <pthread.h>
16 15
17 // We use error-checking mutexes in Debug builds or normal fast mutexes in Relea se builds. 16 // We use error-checking mutexes in Debug builds or normal fast mutexes in Relea se builds.
18 // Debug builds get these checks for free: 17 // Debug builds get these checks for free:
19 // - a double acquire() from the same thread fails immediately instead of dead locking; 18 // - a double acquire() from the same thread fails immediately instead of dead locking;
20 // - release() checks that the mutex is being unlocked by its owner thread. 19 // - release() checks that the mutex is being unlocked by its owner thread.
21 // I don't see a built-in way to implement assertHeld(), so we track that with a n fOwner field. 20 // I don't see a built-in way to implement assertHeld(), so we track that with a n fOwner field.
22 21
23 // This isn't technically portable, but on Linux and Android pthread_t is some s ort of int, and 22 // This isn't technically portable, but on Linux and Android pthread_t is some s ort of int, and
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // 87 //
89 // Without magic statics there are no thread safety guarantees on initialization 88 // Without magic statics there are no thread safety guarantees on initialization
90 // of local statics (even POD). As a result, it is illegal to use 89 // of local statics (even POD). As a result, it is illegal to use
91 // SK_DECLARE_STATIC_MUTEX in a function. 90 // SK_DECLARE_STATIC_MUTEX in a function.
92 // 91 //
93 // Because SkBaseMutex is not a primitive, a static SkBaseMutex cannot be 92 // Because SkBaseMutex is not a primitive, a static SkBaseMutex cannot be
94 // initialized in a class with this macro. 93 // initialized in a class with this macro.
95 #define SK_DECLARE_STATIC_MUTEX(name) namespace {} static SkBaseMutex name = SK_ BASE_MUTEX_INIT 94 #define SK_DECLARE_STATIC_MUTEX(name) namespace {} static SkBaseMutex name = SK_ BASE_MUTEX_INIT
96 95
97 #endif 96 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698