Skip to content

Commit

Permalink
Adding useful typedefs to unlock_object.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Hare committed Aug 8, 2014
1 parent b35f4b8 commit 4fd6d50
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions autowiring/unlock_object.h
Expand Up @@ -8,13 +8,14 @@ template<class object, class lock> class atomic_object;
///</summary>
///<remarks>
///An unlock_object cannot be copied by construction or assignment since it maintains access.
///An unlock_object cannot be used to extend the existence of an atomic_object.
///An unlock_object cannot be used to extend the existence of an atomic_object beyond the
///span of existence of the unlock_object.
///</remarks>
template<class object_type, class lock_type = std::mutex>
class unlock_object {
public:
typedef object_type object;
typedef atomic_object<object_type, lock_type> atomic;
typedef typename atomic::object object;
typedef typename atomic::lock lock;
typedef typename atomic::shared shared;

Expand All @@ -36,7 +37,7 @@ class unlock_object {
///Construction references the object and maintains a lock, yielding bool(*this) == true;
///</summary>
///<param name="should_try">If true, the returned unlock_object might hold no reference or lock</param>
unlock_object(shared& source, bool should_try = false) {
unlock_object(shared source, bool should_try = false) {
acquire(source, should_try);
}

Expand Down Expand Up @@ -68,7 +69,7 @@ class unlock_object {
///This method is idempotent, including when called repeatedly with the same argument.
///However, acquire(source) always releases the any currently held lock.
///</remarks>
void acquire(shared& source, bool should_try = false) {
void acquire(shared source, bool should_try = false) {
release();
if (!source) {
return;
Expand Down

0 comments on commit 4fd6d50

Please sign in to comment.