Provides a mechanism that synchronizes access to objects with xtd::threading::monitor.
Public Constructors | |
template<class object_t> | |
lock (const object_t &obj) | |
Create a xtd::threading::lock object and acquires an exclusive lock on the specified obj. | |
Public Methods | |
void | pulse () |
Notifies a thread in the waiting queue of a change in the locked object's state. | |
void | pulse_all () |
Notifies all waiting threads of a change in the object's state. | |
bool | wait (int32 milliseconds_timeout) |
Releases the lock on an object and blocks the current thread until it reacquires the lock. If the specified time-out interval elapses, the thread enters the ready queue. | |
bool | wait (const time_span &timeout) |
Releases the lock on an object and blocks the current thread until it reacquires the lock. If the specified time-out interval elapses, the thread enters the ready queue. | |
bool | wait () |
Releases the lock on an object and blocks the current thread until it reacquires the lock. | |
Additional Inherited Members | |
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 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::unique_ptr_object< 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. | |
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. | |
|
inlineexplicit |
Create a xtd::threading::lock object and acquires an exclusive lock on the specified obj.
obj | The object on which to acquire the monitor lock. |
void xtd::threading::lock::pulse | ( | ) |
Notifies a thread in the waiting queue of a change in the locked object's state.
void xtd::threading::lock::pulse_all | ( | ) |
Notifies all waiting threads of a change in the object's state.
bool xtd::threading::lock::wait | ( | int32 | milliseconds_timeout | ) |
Releases the lock on an object and blocks the current thread until it reacquires the lock. If the specified time-out interval elapses, the thread enters the ready queue.
obj | The object on which to wait. |
milliseconds_timeout | The number of milliseconds to wait before the thread enters the ready queue. |
true
if the lock was reacquired before the specified time elapsed; false
if the lock was reacquired after the specified time elapsed. The method does not return until the lock is reacquired. xtd::threading::synchronization_lock_exception | xtd::threading::monitor::wait is not invoked from within a synchronized block of code. |
bool xtd::threading::lock::wait | ( | const time_span & | timeout | ) |
Releases the lock on an object and blocks the current thread until it reacquires the lock. If the specified time-out interval elapses, the thread enters the ready queue.
timeout | A xtd::time_span representing the amount of time to wait before the thread enters the ready queue. |
true
if the lock was reacquired before the specified time elapsed; false
if the lock was reacquired after the specified time elapsed. The method does not return until the lock is reacquired. xtd::threading::synchronization_lock_exception | xtd::threading::monitor::wait is not invoked from within a synchronized block of code. |
bool xtd::threading::lock::wait | ( | ) |
Releases the lock on an object and blocks the current thread until it reacquires the lock.
true
if the call returned because the caller reacquired the lock for the specified object. This method does not return if the lock is not reacquired. xtd::threading::synchronization_lock_exception | xtd::threading::monitor::wait is not invoked from within a synchronized block of code. |