xtd 0.2.0
Loading...
Searching...
No Matches
lock_guard.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../block_scope.hpp"
6#include "../object.hpp"
7#include "../ptr.hpp"
8#include "../string.hpp"
9
11namespace xtd {
13 namespace threading {
33 class core_export_ lock_guard final : public object {
34 public:
35 struct data;
36
38
43 template<class object_t>
44 explicit lock_guard(const object_t& obj) : lock_guard {reinterpret_cast<xtd::intptr>(&obj)} {}
45
49 explicit lock_guard(const xtd::string& str);
51
53 explicit lock_guard(xtd::intptr ptr);
54 explicit lock_guard(const std::string& str);
55 explicit lock_guard(const char* str);
56 explicit lock_guard(const xtd::char16* str);
57 explicit lock_guard(const xtd::char32* str);
58 explicit lock_guard(const xtd::char8* str);
59 explicit lock_guard(const xtd::wchar* str);
62
64
68 void enter();
69
73 void exit();
75
76 private:
77 lock_guard() = delete;
78 xtd::ptr<data> data_;
79 };
80 }
81}
82
83#include "../lock_guard.hpp"
Contains block_scope_ keyword.
object()=default
Create a new instance of the ultimate base class object.
lock_guard(const xtd::string &str)
Create a xtd::threading::lock_guard object and acquires an exclusive lock_guard on the specified stri...
void exit()
Exits the lock_guard.
void enter()
Enters the lock_guard, waiting if necessary until the lock_guard can be entered.
lock_guard(const object_t &obj)
Create a xtd::threading::lock_guard object and acquires an exclusive lock_guard on the specified obj.
Definition lock_guard.hpp:44
#define core_export_
Define shared library export.
Definition core_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
char8_t char8
Represents a 8-bit unicode character.
Definition char8.hpp:26
wchar_t wchar
Represents a wide character.
Definition wchar.hpp:24
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.hpp:27
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:23
Contains lock_guard_ keyword.
The xtd::threading namespace provides classes and interfaces that enable multithreaded programming....
Definition abandoned_mutex_exception.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
Contains xtd::object class.
Contains xtd::ptr type.
Contains xtd::string alias.