xtd 0.2.0
Loading...
Searching...
No Matches
event_wait_handle.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "wait_handle.hpp"
7#include "../icomparable.hpp"
8#include "../iequatable.hpp"
9
11namespace xtd {
13 namespace threading {
37 class core_export_ event_wait_handle : public wait_handle, public icomparable<event_wait_handle>, public iequatable<event_wait_handle> {
38 class event_wait_handle_base;
39 class named_event_wait_handle;
40 class unnamed_event_wait_handle;
41 struct data;
42
43 public:
45
47 event_wait_handle();
51 explicit event_wait_handle(bool initial_state);
55 explicit event_wait_handle(const string& name);
59 event_wait_handle(const string& name, bool& created_new);
63 event_wait_handle(bool initial_state, const string& name);
68 event_wait_handle(bool initial_state, const string& name, bool& created_new);
74 event_wait_handle(bool initial_state, event_reset_mode mode);
87 event_wait_handle(bool initial_state, event_reset_mode mode, const string& name);
101 event_wait_handle(bool initial_state, event_reset_mode mode, const string& name, bool& created_new);
103
105 template<class char_t>
106 explicit event_wait_handle(const char_t* name) : event_wait_handle(string(name)) {}
109
111
113 [[nodiscard]] auto handle() const noexcept -> intptr override;
114 void handle(intptr value) override;
116
118
120 auto close() -> void override;
121
122 [[nodiscard]] auto compare_to(const event_wait_handle& value) const noexcept -> int32 override;
123
127 [[nodiscard]] auto equals(const object& obj) const noexcept -> bool override;
131 [[nodiscard]] auto equals(const event_wait_handle& other) const noexcept -> bool override;
132
136 auto reset() -> bool;
137
144 auto set() -> bool;
146
148
161 [[nodiscard]] static auto open_existing(const string& name) -> event_wait_handle;
162
175 [[nodiscard]] static auto try_open_existing(const string& name, event_wait_handle& result) noexcept -> bool;
177
178 protected:
180
182 auto signal() -> bool override;
183
184 auto wait(int32 milliseconds_timeout) -> bool override;
186
187 private:
188 auto create(bool initial_state, bool& created_new) -> void;
189
190 xtd::sptr<data> data_;
191 };
192 }
193}
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:22
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Represents a thread synchronization event.
Definition event_wait_handle.hpp:37
static auto open_existing(const string &name) -> event_wait_handle
Opens the specified named synchronization event, if it already exists.
auto set() -> bool
Sets the state of the event to signaled, allowing one or more waiting threads to proceed.
static auto try_open_existing(const string &name, event_wait_handle &result) noexcept -> bool
Opens the specified named synchronization event, if it already exists, and returns a value that indic...
auto wait(int32 milliseconds_timeout) -> bool override
wait ownership of the specified mutex object.
auto signal() -> bool override
Releases ownership of the specified wait_handle object.
event_wait_handle(bool initial_state, const string &name, bool &created_new)
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wai...
auto reset() -> bool
Sets the state of the event to nonsignaled, causing threads to block.
event_wait_handle(bool initial_state, const string &name)
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wai...
event_wait_handle(bool initial_state, event_reset_mode mode, const string &name)
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wai...
event_wait_handle(const string &name, bool &created_new)
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wai...
event_wait_handle(const string &name)
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying the name.
event_wait_handle(bool initial_state, event_reset_mode mode, const string &name, bool &created_new)
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wai...
event_wait_handle(bool initial_state)
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wai...
auto handle() const noexcept -> intptr override
Gets the native operating system handle.
auto equals(const object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto close() -> void override
Releases all resources held by the current xtd::threading::wait_handle.
event_wait_handle(bool initial_state, event_reset_mode mode)
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wai...
wait_handle()=default
Initializes a new instance of the xtd::threading::wait_handle class.
Contains xtd::threading::event_reset_mode enumeration.
#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
event_reset_mode
Indicates whether an xtd::threading::event_wait_handle is reset automatically or manually after recei...
Definition event_reset_mode.hpp:28
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
std::intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
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::threading::wait_handle class.