YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/util/shared_lock.h
Line
Count
Source
1
//
2
// Copyright (c) YugaByte, Inc.
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5
// in compliance with the License.  You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software distributed under the License
10
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11
// or implied.  See the License for the specific language governing permissions and limitations
12
// under the License.
13
14
#ifndef YB_UTIL_SHARED_LOCK_H
15
#define YB_UTIL_SHARED_LOCK_H
16
17
#include <shared_mutex>
18
19
#include "yb/gutil/thread_annotations.h"
20
21
namespace yb {
22
23
// A wrapper around Boost shared lock that supports thread annotations.
24
template<typename Mutex>
25
class SCOPED_CAPABILITY SharedLock {
26
 public:
27
208M
  explicit SharedLock(Mutex &mutex) ACQUIRE_SHARED(mutex) : m_lock(mutex) {}
Unexecuted instantiation: _ZN2yb10SharedLockIKNS_9CowObjectINS_6master20PersistentTabletInfoEEEEC2ERS5_
_ZN2yb10SharedLockINS_7RWMutexEEC2ERS1_
Line
Count
Source
27
18.2M
  explicit SharedLock(Mutex &mutex) ACQUIRE_SHARED(mutex) : m_lock(mutex) {}
_ZN2yb10SharedLockINS_12rw_semaphoreEEC2ERS1_
Line
Count
Source
27
206k
  explicit SharedLock(Mutex &mutex) ACQUIRE_SHARED(mutex) : m_lock(mutex) {}
_ZN2yb10SharedLockINS_11rw_spinlockEEC2ERS1_
Line
Count
Source
27
176M
  explicit SharedLock(Mutex &mutex) ACQUIRE_SHARED(mutex) : m_lock(mutex) {}
_ZN2yb10SharedLockINSt3__118shared_timed_mutexEEC2ERS2_
Line
Count
Source
27
13.0M
  explicit SharedLock(Mutex &mutex) ACQUIRE_SHARED(mutex) : m_lock(mutex) {}
28
208M
  ~SharedLock() RELEASE() = default;
Unexecuted instantiation: _ZN2yb10SharedLockIKNS_9CowObjectINS_6master20PersistentTabletInfoEEEED2Ev
_ZN2yb10SharedLockINS_7RWMutexEED2Ev
Line
Count
Source
28
18.2M
  ~SharedLock() RELEASE() = default;
_ZN2yb10SharedLockINS_12rw_semaphoreEED2Ev
Line
Count
Source
28
206k
  ~SharedLock() RELEASE() = default;
_ZN2yb10SharedLockINS_11rw_spinlockEED2Ev
Line
Count
Source
28
176M
  ~SharedLock() RELEASE() = default;
_ZN2yb10SharedLockINSt3__118shared_timed_mutexEED2Ev
Line
Count
Source
28
13.0M
  ~SharedLock() RELEASE() = default;
29
30
 private:
31
  std::shared_lock<Mutex> m_lock;
32
};
33
34
} // namespace yb
35
36
#endif  // YB_UTIL_SHARED_LOCK_H