QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "net/third_party/quiche/src/quic/platform/api/quic_mutex.h" |
| 6 | |
| 7 | namespace quic { |
| 8 | |
| 9 | void QuicMutex::WriterLock() { |
| 10 | impl_.WriterLock(); |
| 11 | } |
| 12 | |
| 13 | void QuicMutex::WriterUnlock() { |
| 14 | impl_.WriterUnlock(); |
| 15 | } |
| 16 | |
| 17 | void QuicMutex::ReaderLock() { |
| 18 | impl_.ReaderLock(); |
| 19 | } |
| 20 | |
| 21 | void QuicMutex::ReaderUnlock() { |
| 22 | impl_.ReaderUnlock(); |
| 23 | } |
| 24 | |
| 25 | void QuicMutex::AssertReaderHeld() const { |
| 26 | impl_.AssertReaderHeld(); |
| 27 | } |
| 28 | |
| 29 | QuicReaderMutexLock::QuicReaderMutexLock(QuicMutex* lock) : lock_(lock) { |
| 30 | lock->ReaderLock(); |
| 31 | } |
| 32 | |
| 33 | QuicReaderMutexLock::~QuicReaderMutexLock() { |
| 34 | lock_->ReaderUnlock(); |
| 35 | } |
| 36 | |
| 37 | QuicWriterMutexLock::QuicWriterMutexLock(QuicMutex* lock) : lock_(lock) { |
| 38 | lock->WriterLock(); |
| 39 | } |
| 40 | |
| 41 | QuicWriterMutexLock::~QuicWriterMutexLock() { |
| 42 | lock_->WriterUnlock(); |
| 43 | } |
| 44 | |
| 45 | } // namespace quic |