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

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

Issue 419113002: Fix thread unsafe mutex initialization. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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
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
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 default: 82 default:
83 SkDebugf("pthread error [%d] unknown\n", status); 83 SkDebugf("pthread error [%d] unknown\n", status);
84 break; 84 break;
85 } 85 }
86 } 86 }
87 }; 87 };
88 88
89 #define SK_BASE_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER, SkDEBUGCODE(0) } 89 #define SK_BASE_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER, SkDEBUGCODE(0) }
90 90
91 // Using POD-style initialization prevents the generation of a static initialize r. 91 // Using POD-style initialization prevents the generation of a static initialize r.
92 #define SK_DECLARE_STATIC_MUTEX(name) static SkBaseMutex name = SK_BASE_MUTEX_IN IT 92 #define SK_DECLARE_STATIC_MUTEX(name) static void SK_MACRO_APPEND_LINE(name)(); static SkBaseMutex name = SK_BASE_MUTEX_INIT
mtklein 2014/07/25 12:35:33 Add a comment about the function declaration here
bungeman-skia 2014/07/25 14:40:40 Hmmm... this one is actually safe (well, in practi
93
94 // Special case used when the static mutex must be available globally.
95 #define SK_DECLARE_GLOBAL_MUTEX(name) SkBaseMutex name = SK_BASE_MUTEX_INIT
96 93
97 #endif 94 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698