Provides a mechanism that synchronizes access to objects with xtd::threading::monitor.
Constructors | |
template<typename object_t > | |
lock_guard (const object_t &obj) | |
Create a xtd::threaing::lock_guard object and acquires an exclusive lock on the specified obj. More... | |
Methods | |
void | pulse () |
Notifies a thread in the waiting queue of a change in the locked object's state. More... | |
void | pulse_all () |
Notifies all waiting threads of a change in the object's state. More... | |
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. More... | |
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. More... | |
bool | wait () |
Releases the lock on an object and blocks the current thread until it reacquires the lock. More... | |
Additional Inherited Members | |
![]() | |
object ()=default | |
Create a new instance of the ultimate base class object. More... | |
bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. More... | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. More... | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. More... | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const noexcept |
Creates a shallow copy of the current object. More... | |
virtual xtd::ustring | to_string () const noexcept |
Returns a sxd::ustring that represents the current object. More... | |
![]() | |
static bool | equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are considered equal. More... | |
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are the same instance. More... | |
|
inlineexplicit |
Create a xtd::threaing::lock_guard object and acquires an exclusive lock on the specified obj.
obj | The object on which to acquire the monitor lock. |
void xtd::threading::lock_guard::pulse | ( | ) |
Notifies a thread in the waiting queue of a change in the locked object's state.
void xtd::threading::lock_guard::pulse_all | ( | ) |
Notifies all waiting threads of a change in the object's state.
bool xtd::threading::lock_guard::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. |
xtd::threading::synchronization_lock_exception | xtd::threading::monitor::wait is not invoked from within a synchronized block of code. |
bool xtd::threading::lock_guard::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. |
xtd::threading::synchronization_lock_exception | xtd::threading::monitor::wait is not invoked from within a synchronized block of code. |
bool xtd::threading::lock_guard::wait | ( | ) |
Releases the lock on an object and blocks the current thread until it reacquires the lock.
xtd::threading::synchronization_lock_exception | xtd::threading::monitor::wait is not invoked from within a synchronized block of code. |