Encapsulates operating system specific objects that wait for exclusive access to shared resources.
Public Fields | |
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. | |
Public Constructors | |
wait_handle ()=default | |
Initializes a new instance of the xtd::threading::wait_handle class. | |
Public Properties | |
virtual intptr | handle () const noexcept=0 |
Gets the native operating system handle. | |
virtual void | handle (intptr value)=0 |
Sets the native operating system handle. | |
Public Methods | |
virtual void | close () |
Releases all resources held by the current xtd::threading::wait_handle. | |
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. | |
Public Static Methods | |
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<typename 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<typename 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<typename 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<typename 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<typename 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<typename 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. | |
Protected Methods | |
virtual bool | signal ()=0 |
Releases ownership of the specified wait_handle object. | |
virtual bool | wait (int32 milliseconds_timeout)=0 |
wait ownership of the specified mutex object. | |
Additional Inherited Members | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. | |
virtual size_t | 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<typename 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. | |
Static Public Member Functions inherited from xtd::object | |
template<typename object_a_t , typename 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<typename object_a_t , typename 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. | |
Protected Member Functions inherited from xtd::abstract_object | |
abstract_object ()=default | |
Initializes a new instance of the xtd::abstract_object class. | |
|
default |
Initializes a new instance of the xtd::threading::wait_handle class.
|
pure virtualnoexcept |
Gets the native operating system handle.
Implemented in xtd::threading::event_wait_handle, xtd::threading::mutex, and xtd::threading::semaphore.
|
pure virtual |
Sets the native operating system handle.
value | An intptr representing the native operating system handle. |
Implemented in xtd::threading::event_wait_handle, xtd::threading::mutex, and xtd::threading::semaphore.
|
virtual |
Releases all resources held by the current xtd::threading::wait_handle.
Reimplemented in xtd::threading::event_wait_handle, xtd::threading::mutex, and xtd::threading::semaphore.
|
virtual |
Blocks the current thread until the current xtd::threading::wait_handle receives a signal.
xtd::object_closed_exception | the handle is invalid |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
|
virtual |
Blocks the current thread until the current xtd::threading::wait_handle receives a signal, using 32-bit signed integer to measure the time interval.
milliseconds_timeout | The number of milliseconds to wait, or xtd::threading::timeout::infinite (-1) to wait indefinitely. |
xtd::object_closed_exception | the handle is invalid |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
xtd::argument_exception | milliseconds_timeout is a negative number other than -1, which represents an infinite time-out. |
|
virtual |
Blocks the current thread until the current instance receives a signal, using a xtd::time_span to measure the time interval.
timeout | A xtd::time_span that represents the number of milliseconds to wait, or a xtd::time_span that represents -1 milliseconds to wait indefinitely. |
xtd::object_closed_exception | the handle is invalid |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
xtd::argument_exception | milliseconds_timeout is a negative number other than -1, which represents an infinite time-out. |
|
static |
Signals one xtd::threading::wait_handle and waits on another.
to_signal | The xtd::threading::wait_handle to signal. |
to_wait | The xtd::threading::wait_handle to wait on. |
xtd::object_closed_exception | the to_signal and/or to_wait are invalid |
xtd::invalid_operation_exception | to_signal is a semaphore, and it already has a full count. |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
|
static |
Signals one xtd::threading::wait_handle and waits on another, specifying a time-out interval as a 32-bit signed integer.
to_signal | The xtd::threading::wait_handle to signal. |
to_wait | The xtd::threading::wait_handle to wait on. |
milliseconds_timeout | An integer that represents the interval to wait. If the value is xtd::threading::timeout::infinite, that is, -1, the wait is infinite |
xtd::object_closed_exception | the to_signal and/or to_wait are invalid |
xtd::invalid_operation_exception | to_signal is a semaphore, and it already has a full count. |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
|
static |
Signals one xtd::threading::wait_handle and waits on another, specifying a time-out interval as a time_span.
to_signal | The wait_handle to signal. |
to_wait | The wait_handle to wait on. |
timeout | A time_span that represents the interval to wait. If the value is -1, the wait is infinite |
xtd::object_closed_exception | the to_signal and/or to_wait are invalid |
xtd::invalid_operation_exception | to_signal is a semaphore, and it already has a full count. |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
|
inlinestatic |
Waits for all the elements in the specified collection to receive a signal.
wait_handles | A xtd::threading::wait_handle collection containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object. |
xtd::object_closed_exception | the to_signal and/or to_wait are invalid |
xtd::argument_exception | The number of objects in wait_handles is greater than the system permits. |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
|
inlinestatic |
Waits for all the elements in the specified collection to receive a signal, using an int32 value to measure the time interval.
wait_handles | A xtd::threading::wait_handle collection containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object. |
milliseconds_timeout | The number of milliseconds to wait, or xtd::threading::timeout::infinite (-1) to wait indefinitely. |
xtd::argument_exception | timeout is a negative number other than -1 milliseconds, which represents an infinite time-out. -or- The number of objects in wait_handles is greater than the system permits. |
xtd::object_closed_exception | the to_signal and/or to_wait are invalid |
xtd::argument_exception | The number of objects in wait_handles is greater than the system permits. |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
|
inlinestatic |
Waits for all the elements in the specified collection to receive a signal, using a xtd::time_span value to measure the time interval.
wait_handles | A xtd::threading::wait_handle collection containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object. |
timeout | A xtd::time_span that represents the number of milliseconds to wait, or a xtd::time_span that represents -1 milliseconds, to wait indefinitely. |
xtd::argument_exception | timeout is a negative number other than -1 milliseconds, which represents an infinite time-out. -or- The number of objects in wait_handles is greater than the system permits. |
xtd::object_closed_exception | the to_signal and/or to_wait are invalid |
xtd::argument_exception | The number of objects in wait_handles is greater than the system permits. |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
|
inlinestatic |
Waits for any of the elements in the specified collection to receive a signal.
wait_handles | A xtd::threading::wait_handle collection containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object. |
xtd::argument_exception | timeout is a negative number other than -1 milliseconds, which represents an infinite time-out. -or- The number of objects in wait_handles is greater than the system permits. |
xtd::object_closed_exception | the to_signal and/or to_wait are invalid |
xtd::argument_exception | The number of objects in wait_handles is greater than the system permits. |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
|
inlinestatic |
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.
wait_handles | A xtd::threading::wait_handle collection containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object. |
milliseconds_timeout | The number of milliseconds to wait, or xtd::threading::timeout::infinite (-1) to wait indefinitely. |
xtd::argument_exception | timeout is a negative number other than -1 milliseconds, which represents an infinite time-out. -or- The number of objects in wait_handles is greater than the system permits. |
xtd::object_closed_exception | the to_signal and/or to_wait are invalid |
xtd::argument_exception | The number of objects in wait_handles is greater than the system permits. |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
|
inlinestatic |
Waits for any of the elements in the specified collection to receive a signal, using a xtd::time_span to measure the time interval.
wait_handles | A xtd::threading::wait_handle collection containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object. |
timeout | A xtd::time_span that represents the number of milliseconds to wait, or a xtd::time_span that represents -1 milliseconds to wait indefinitely. |
xtd::argument_exception | timeout is a negative number other than -1 milliseconds, which represents an infinite time-out. -or- The number of objects in wait_handles is greater than the system permits. |
xtd::object_closed_exception | the to_signal and/or to_wait are invalid |
xtd::argument_exception | The number of objects in wait_handles is greater than the system permits. |
xtd::threading::abandoned_mutex_exception | The wait completed because a thread exited without releasing a mutex. |
|
protectedpure virtual |
Releases ownership of the specified wait_handle object.
Implemented in xtd::threading::event_wait_handle, xtd::threading::mutex, and xtd::threading::semaphore.
|
protectedpure virtual |
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. |
Implemented in xtd::threading::event_wait_handle, xtd::threading::mutex, and xtd::threading::semaphore.
|
static |
Represents an invalid native operating system handle. This field is read-only.
|
staticconstexpr |
Indicates that a xtd::threading::wait_handle::wait_any operation timed out before any of the wait handles were signaled. This field is constant.