template<typename TOwnable, bool TOptional = false>
class alib::lang::OwnerTryShared< TOwnable, TOptional >
Similar to class Owner, but calls method TryAcquireShared instead of Acquire and ReleaseShared instead of Release. The result is retrievable with the 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 TryAcquireShared and ReleaseShared 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 492 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 561 of file owner.inl.