Represents a thread synchronization event.
Public Constructors | |
event_wait_handle (bool initial_state) | |
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wait handle is initially signaled. | |
event_wait_handle (const string &name) | |
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying the name. | |
event_wait_handle (const string &name, bool &created_new) | |
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, the name of a system synchronization event, and a bool variable whose value after the call indicates whether the named system event was created. | |
event_wait_handle (bool initial_state, const string &name) | |
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wait handle is initially signaled if created as a result of this call, and the name of a system synchronization event. | |
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 wait handle is initially signaled if created as a result of this call, the name of a system synchronization event, and a bool variable whose value after the call indicates whether the named system event was created. | |
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 wait handle is initially signaled, and whether it resets automatically or manually. | |
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 wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, and the name of a system synchronization event. | |
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 wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, the name of a system synchronization event, and a bool variable whose value after the call indicates whether the named system event was created. | |
Public Properties | |
intptr | handle () const noexcept override |
Gets the native operating system handle. | |
void | handle (intptr value) override |
Sets the native operating system handle. | |
Public Methods | |
void | close () override |
Releases all resources held by the current xtd::threading::wait_handle. | |
int32 | compare_to (const event_wait_handle &value) const noexcept override |
bool | equals (const object &obj) const noexcept override |
Determines whether the specified object is equal to the current object. | |
bool | equals (const event_wait_handle &other) const noexcept override |
Determines whether the specified object is equal to the current object. | |
bool | reset () |
Sets the state of the event to nonsignaled, causing threads to block. | |
bool | set () |
Sets the state of the event to signaled, allowing one or more waiting threads to proceed. | |
Public Static Methods | |
static event_wait_handle | open_existing (const string &name) |
Opens the specified named synchronization event, if it already exists. | |
static bool | try_open_existing (const string &name, event_wait_handle &result) noexcept |
Opens the specified named synchronization event, if it already exists, and returns a value that indicates whether the operation succeeded. | |
Protected Methods | |
bool | signal () override |
Releases ownership of the specified wait_handle object. | |
bool | wait (int32 milliseconds_timeout) override |
wait ownership of the specified mutex object. | |
Additional Inherited Members | |
![]() | |
static const intptr | invalid_handle |
Represents an invalid native operating system handle. This field is read-only. | |
static constexpr size_t | wait_timeout |
Indicates that a xtd::threading::wait_handle::wait_any operation timed out before any of the wait handles were signaled. This field is constant. | |
![]() | |
wait_handle ()=default | |
Initializes a new instance of the xtd::threading::wait_handle class. | |
virtual bool | wait_one () |
Blocks the current thread until the current xtd::threading::wait_handle receives a signal. | |
virtual bool | wait_one (int32 milliseconds_timeout) |
Blocks the current thread until the current xtd::threading::wait_handle receives a signal, using 32-bit signed integer to measure the time interval. | |
virtual bool | wait_one (const time_span &timeout) |
Blocks the current thread until the current instance receives a signal, using a xtd::time_span to measure the time interval. | |
![]() | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual xtd::size | get_hash_code () const noexcept |
Serves as a hash function for a particular type. | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. | |
template<class object_t > | |
xtd::uptr< object_t > | memberwise_clone () const |
Creates a shallow copy of the current object. | |
virtual xtd::string | to_string () const noexcept |
Returns a xtd::string that represents the current object. | |
![]() | |
virtual int32 | compare_to (const event_wait_handle &obj) const noexcept=0 |
Compares the current instance with another object of the same type. | |
![]() | |
virtual bool | equals (const event_wait_handle &) const noexcept=0 |
Indicates whether the current object is equal to another object of the same type. | |
![]() | |
static bool | signal_and_wait (wait_handle &to_signal, wait_handle &to_wait) |
Signals one xtd::threading::wait_handle and waits on another. | |
static bool | signal_and_wait (wait_handle &to_signal, wait_handle &to_wait, int32 milliseconds_timeout) |
Signals one xtd::threading::wait_handle and waits on another, specifying a time-out interval as a 32-bit signed integer. | |
static bool | signal_and_wait (wait_handle &to_signal, wait_handle &to_wait, const time_span &timeout) |
Signals one xtd::threading::wait_handle and waits on another, specifying a time-out interval as a time_span. | |
template<class collection_t > | |
static bool | wait_all (const collection_t &wait_handles) |
Waits for all the elements in the specified collection to receive a signal. | |
template<class collection_t > | |
static bool | wait_all (const collection_t &wait_handles, int32 milliseconds_timeout) |
Waits for all the elements in the specified collection to receive a signal, using an int32 value to measure the time interval. | |
template<class collection_t > | |
static bool | wait_all (const collection_t &wait_handles, const time_span &timeout) |
Waits for all the elements in the specified collection to receive a signal, using a xtd::time_span value to measure the time interval. | |
template<class collection_t > | |
static size_t | wait_any (const collection_t &wait_handles) |
Waits for any of the elements in the specified collection to receive a signal. | |
template<class collection_t > | |
static size_t | wait_any (const collection_t &wait_handles, int32 milliseconds_timeout) |
Waits for any of the elements in the specified collection to receive a signal, using a 32-bit signed integer to measure the time interval. | |
template<class collection_t > | |
static size_t | wait_any (const collection_t &wait_handles, const time_span &timeout) |
Waits for any of the elements in the specified collection to receive a signal, using a xtd::time_span to measure the time interval. | |
![]() | |
template<class object_a_t , class object_b_t > | |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
template<class object_a_t , class object_b_t > | |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
![]() | |
![]() | |
abstract_object ()=default | |
Initializes a new instance of the xtd::abstract_object class. | |
|
explicit |
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wait handle is initially signaled.
initial_state | true to set the initial state to signaled; false to set it to nonsignaled. |
|
explicit |
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying the name.
name | The name, if the synchronization object is to be shared with other processes; otherwise, null or an empty string. The name is case-sensitive. The backslash character () is reserved and may only be used to specify a namespace. For more information on namespaces, see the remarks section. There may be further restrictions on the name depending on the operating system. For example, on Unix-based operating systems, the name after excluding the namespace must be a valid file name. |
false
and the mode is set to xtd::threading::event_reset_mode::auto_reset. xtd::threading::event_wait_handle::event_wait_handle | ( | const string & | name, |
bool & | created_new | ||
) |
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, the name of a system synchronization event, and a bool variable whose value after the call indicates whether the named system event was created.
name | The name, if the synchronization object is to be shared with other processes; otherwise, null or an empty string. The name is case-sensitive. The backslash character () is reserved and may only be used to specify a namespace. For more information on namespaces, see the remarks section. There may be further restrictions on the name depending on the operating system. For example, on Unix-based operating systems, the name after excluding the namespace must be a valid file name. |
created_new | When this method returns, contains true if a local event was created (that is, if name is null or an empty string) or if the specified named system event was created; false if the specified named system event already existed. This parameter is passed uninitialized. |
xtd::threading::event_wait_handle::event_wait_handle | ( | bool | initial_state, |
const string & | name | ||
) |
Initializes a new instance of the xtd::threading::event_wait_handle class, specifying whether the wait handle is initially signaled if created as a result of this call, and the name of a system synchronization event.
initial_state | true to set the initial state to signaled; false to set it to nonsignaled. |
name | The name, if the synchronization object is to be shared with other processes; otherwise, null or an empty string. The name is case-sensitive. The backslash character () is reserved and may only be used to specify a namespace. For more information on namespaces, see the remarks section. There may be further restrictions on the name depending on the operating system. For example, on Unix-based operating systems, the name after excluding the namespace must be a valid file name. |
xtd::threading::event_wait_handle::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 wait handle is initially signaled if created as a result of this call, the name of a system synchronization event, and a bool variable whose value after the call indicates whether the named system event was created.
initial_state | true to set the initial state to signaled; false to set it to nonsignaled. |
name | The name, if the synchronization object is to be shared with other processes; otherwise, null or an empty string. The name is case-sensitive. The backslash character () is reserved and may only be used to specify a namespace. For more information on namespaces, see the remarks section. There may be further restrictions on the name depending on the operating system. For example, on Unix-based operating systems, the name after excluding the namespace must be a valid file name. |
created_new | When this method returns, contains true if a local event was created (that is, if name is null or an empty string) or if the specified named system event was created; false if the specified named system event already existed. This parameter is passed uninitialized. |
xtd::threading::event_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 wait handle is initially signaled, and whether it resets automatically or manually.
initial_state | true to set the initial state to signaled; false to set it to nonsignaled. |
mode | One of the xtd::threading::event_reset_mode values that determines whether the event resets automatically or manually. |
xtd::argument_excpetion | The mode enum value was out of legal range. |
xtd::threading::event_wait_handle::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 wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, and the name of a system synchronization event.
initial_state | true to set the initial state to signaled; false to set it to nonsignaled. |
mode | One of the xtd::threading::event_reset_mode values that determines whether the event resets automatically or manually. |
name | The name, if the synchronization object is to be shared with other processes; otherwise, null or an empty string. The name is case-sensitive. The backslash character () is reserved and may only be used to specify a namespace. For more information on namespaces, see the remarks section. There may be further restrictions on the name depending on the operating system. For example, on Unix-based operating systems, the name after excluding the namespace must be a valid file name. |
xtd::argument_excpetion | The mode enum value was out of legal range. |
xtd::io::io_exception | name is invalid. This can be for various reasons, including some restrictions that may be placed by the operating system, such as an unknown prefix or invalid characters. Note that the name and common prefixes "Global\" and "Local" are case-sensitive. -or- There was some other error. The HResult property may provide more information. |
xtd::io::path_to_long_exception | The name is too long. Length restrictions may depend on the operating system or configuration. |
false
for initial_state. This constructor provides no way to determine whether a named system event was created, so you cannot make any assumptions about the state of the named event. To determine whether a named event was created, use the xtd::threading::event_wait_handle(bool, xtd::threading::event_reset_mode, xtd::utring, bool) constructor or the xtd::threading::event_wait_handle(bool, xtd::threading::event__reset_mode, xtd:string, bool) constructor. xtd::threading::event_wait_handle::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 wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, the name of a system synchronization event, and a bool variable whose value after the call indicates whether the named system event was created.
initial_state | true to set the initial state to signaled; false to set it to nonsignaled. |
mode | One of the xtd::threading::event_reset_mode values that determines whether the event resets automatically or manually. |
name | The name, if the synchronization object is to be shared with other processes; otherwise, null or an empty string. The name is case-sensitive. The backslash character () is reserved and may only be used to specify a namespace. For more information on namespaces, see the remarks section. There may be further restrictions on the name depending on the operating system. For example, on Unix-based operating systems, the name after excluding the namespace must be a valid file name. |
created_new | When this method returns, contains true if a local event was created (that is, if name is null or an empty string) or if the specified named system event was created; false if the specified named system event already existed. This parameter is passed uninitialized. |
xtd::io::io_exception | name is invalid. This can be for various reasons, including some restrictions that may be placed by the operating system, such as an unknown prefix or invalid characters. Note that the name and common prefixes "Global\" and "Local" are case-sensitive. -or- There was some other error. The HResult property may provide more information. |
xtd::io::path_too_long_exception | The name is too long. Length restrictions may depend on the operating system or configuration. |
xtd::threading::wait_handle_cannot_be_opened_exception | A synchronization object with the provided name cannot be created. A synchronization object of a different type might have the same name. |
xtd::argument_exception | The mode enum value was out of legal range. |
|
overridevirtualnoexcept |
Gets the native operating system handle.
Implements xtd::threading::wait_handle.
|
overridevirtual |
Sets the native operating system handle.
value | An intptr representing the native operating system handle. |
Implements xtd::threading::wait_handle.
|
overridevirtual |
Releases all resources held by the current xtd::threading::wait_handle.
Reimplemented from xtd::threading::wait_handle.
|
overridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
obj | The object to compare with the current object. |
true
if the specified object is equal to the current object. otherwise, false
. Reimplemented from xtd::object.
|
overridenoexcept |
Determines whether the specified object is equal to the current object.
other | The object to compare with the current object. |
true
if the specified object is equal to the current object. otherwise, false
. bool xtd::threading::event_wait_handle::reset | ( | ) |
Sets the state of the event to nonsignaled, causing threads to block.
true
if the operation succeeds; otherwise, false
. xtd::object_closed_exception | The xtd::threading::wait_handle::close() method was previously called on this xtd::threading::event_wait_handle. |
bool xtd::threading::event_wait_handle::set | ( | ) |
Sets the state of the event to signaled, allowing one or more waiting threads to proceed.
true
if the operation succeeds; otherwise, false
. xtd::object_closed_exception | The xtd::threading::wait_handle::close() method was previously called on this xtd::threading::event_wait_handle. |
|
static |
Opens the specified named synchronization event, if it already exists.
name | The name of the synchronization object to be opened and shared with other processes. The name is case-sensitive. The backslash character () is reserved and may only be used to specify a namespace. For more information on namespaces, see the remarks section. There may be further restrictions on the name depending on the operating system. For example, on Unix-based operating systems, the name after excluding the namespace must be a valid file name. |
xtd::threading::wait_handle_cannot_be_opened_exception | A synchronization object with the provided name cannot be opened. It may not exist, or a synchronization object of a different type might have the same name. In some cases, this exception may be thrown for invalid names. |
xtd::argument_exception | name is an empty string. |
xtd::io_io_exception | name is invalid. This can be for various reasons, including some restrictions that may be placed by the operating system, such as an unknown prefix or invalid characters. Note that the name and common prefixes "Global\" and "Local" are case-sensitive. -or- There was some other error. The HResult property may provide more information. |
xtd::io::path_too_long_exception | The name is too long. Length restrictions may depend on the operating system or configuration. |
|
staticnoexcept |
Opens the specified named synchronization event, if it already exists, and returns a value that indicates whether the operation succeeded.
name | The name of the synchronization object to be opened and shared with other processes. The name is case-sensitive. The backslash character () is reserved and may only be used to specify a namespace. For more information on namespaces, see the remarks section. There may be further restrictions on the name depending on the operating system. For example, on Unix-based operating systems, the name after excluding the namespace must be a valid file name. |
result | When this method returns, contains a The xtd::threading::event_wait_handle object that represents the named synchronization event if the call succeeded, or null if the call failed. This parameter is treated as uninitialized. |
true
if the named synchronization event was opened successfully; otherwise, false
. In some cases, false
may be returned for invalid names. xtd::argument_exception | name is an empty string. |
xtd::io::io_exception | name is invalid. This can be for various reasons, including some restrictions that may be placed by the operating system, such as an unknown prefix or invalid characters. Note that the name and common prefixes "Global\" and "Local" are case-sensitive. For some invalid names, the method may return `false` instead. -or- There was some other error. The HResult property may provide more information. |
xtd::io::path_too_long_exception | The name is too long. Length restrictions may depend on the operating system or configuration. |
false
is returned.
|
overrideprotectedvirtual |
Releases ownership of the specified wait_handle object.
true
If the function succeeds, false
otherwise. Implements xtd::threading::wait_handle.
|
overrideprotectedvirtual |
wait ownership of the specified mutex object.
handle | A valid handle to an open object. |
milliseconds_timeout | The number of milliseconds to wait, or -1 to wait indefinitely. |
true
if the current instance receives a signal; otherwise, false
. Implements xtd::threading::wait_handle.