template<typename TOwnable, bool TOptional = false>
class alib::lang::OwnerTry< TOwnable, TOptional >
Similar to class Owner, but calls method TryAcquire instead of Acquire. The result is retrievable with method IsOwning().
- See also
- Chapter 3.3.1 Class Owner And Its Siblings of the Programmer's Manual of module ALib Threads
- Template Parameters
-
| TOwnable | The type to own. Requirements are to have methods TryAcquire and Release available. |
| TOptional | If true, then checks is performed, whether the given owned is nulled and thus not acquired and released. If false such checks are omitted. |
Definition at line 120 of file owner.inl.
template<typename TOwnable, bool TOptional = false>
Sets the ownable after construction. This method is only available if the template parameter TOptional is true. It must not be called if an object was given with construction already, and it must not be called twice. If done, an assertion is raised.
- Parameters
-
| ownable | The ownable to acquire. |
- Returns
true if the try to acquire the owner was successful, false if not.
Definition at line 193 of file owner.inl.