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: webrtc/system_wrappers/source/critical_section.cc

Issue 1614373002: Remove implementation of CriticalSectionWrapper and use rtc::CriticalSection (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix impl Created 4 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
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
12
13 namespace webrtc {
14
15 CriticalSectionWrapper* CriticalSectionWrapper::CreateCriticalSection() {
16 return new CriticalSectionWrapper();
17 }
18
19 #if defined (WEBRTC_WIN)
20
21 CriticalSectionWrapper::CriticalSectionWrapper() {
22 InitializeCriticalSection(&crit_);
23 }
24
25 CriticalSectionWrapper::~CriticalSectionWrapper() {
26 DeleteCriticalSection(&crit_);
27 }
28
29 void CriticalSectionWrapper::Enter() {
30 EnterCriticalSection(&crit_);
31 }
32
33 void CriticalSectionWrapper::Leave() {
34 LeaveCriticalSection(&crit_);
35 }
36
37 #else
38
39 CriticalSectionWrapper::CriticalSectionWrapper() {
40 pthread_mutexattr_t attr;
41 pthread_mutexattr_init(&attr);
42 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
43 pthread_mutex_init(&mutex_, &attr);
44 }
45
46 CriticalSectionWrapper::~CriticalSectionWrapper() {
47 pthread_mutex_destroy(&mutex_);
48 }
49
50 void CriticalSectionWrapper::Enter() {
51 pthread_mutex_lock(&mutex_);
52 }
53
54 void CriticalSectionWrapper::Leave() {
55 pthread_mutex_unlock(&mutex_);
56 }
57
58 #endif
59
60 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/system_wrappers/include/critical_section_wrapper.h ('k') | webrtc/system_wrappers/system_wrappers.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698