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

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

Issue 19808007: Split atomic and mutex implementations and make inlinable. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Include all the files. Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
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
8 #ifndef SkMutex_win_DEFINED
9 #define SkMutex_win_DEFINED
10
11 /** Windows CriticalSection based mutex. */
12
13 #include "SkTypes.h"
14
15 // On Windows, SkBaseMutex and SkMutex are the same thing,
16 // we can't easily get rid of static initializers.
17 class SkMutex : SkNoncopyable {
18 public:
19 SkMutex() {
20 InitializeCriticalSection(&fStorage);
21 }
22
23 ~SkMutex() {
24 DeleteCriticalSection(&fStorage);
25 }
26
27 void acquire() {
28 EnterCriticalSection(&fStorage);
29 }
30
31 void release() {
32 LeaveCriticalSection(&fStorage);
33 }
34
35 private:
36 CRITICAL_SECTION fStorage;
37 };
38
39 typedef SkMutex SkBaseMutex;
40
41 // Windows currently provides no documented means of POD initializing a CRITICAL _SECTION.
42 #define SK_DECLARE_STATIC_MUTEX(name) static SkBaseMutex name
43 #define SK_DECLARE_GLOBAL_MUTEX(name) SkBaseMutex name
44
45 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698