LLDB mainline
SBMutex.h
Go to the documentation of this file.
1//===-- SBMutex.h ---------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_API_SBMUTEX_H
10#define LLDB_API_SBMUTEX_H
11
12#include "lldb/API/SBDefines.h"
13#include "lldb/lldb-forward.h"
14#include <mutex>
15
16namespace lldb {
17
19public:
20 SBMutex();
21 SBMutex(const SBMutex &rhs);
22 const SBMutex &operator=(const SBMutex &rhs);
23 ~SBMutex();
24
25 /// Returns true if this lock has ownership of the underlying mutex.
26 bool IsValid() const;
27
28 /// Blocking operation that takes ownership of this lock.
29 void lock() const;
30
31 /// Releases ownership of this lock.
32 void unlock() const;
33
34private:
35 // Private constructor used by SBTarget to create the Target API mutex.
36 // Requires a friend declaration.
37 SBMutex(lldb::TargetSP target_sp);
38 friend class SBTarget;
39
40 std::shared_ptr<std::recursive_mutex> m_opaque_sp;
41};
42
43} // namespace lldb
44
45#endif
#define LLDB_API
Definition: SBDefines.h:28
std::shared_ptr< std::recursive_mutex > m_opaque_sp
Definition: SBMutex.h:40
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::Target > TargetSP
Definition: lldb-forward.h:456