diff options
Diffstat (limited to 'boost/interprocess/sync/sharable_lock.hpp')
-rw-r--r-- | boost/interprocess/sync/sharable_lock.hpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/boost/interprocess/sync/sharable_lock.hpp b/boost/interprocess/sync/sharable_lock.hpp index c8b7c1d26e..9342e45a46 100644 --- a/boost/interprocess/sync/sharable_lock.hpp +++ b/boost/interprocess/sync/sharable_lock.hpp @@ -67,7 +67,7 @@ class sharable_lock {} //!Effects: m.lock_sharable(). - //!Postconditions: owns() == true and mutex() == &m. + //!Postconditions: owns() == true and mutex() == &m. //!Notes: The constructor will take sharable-ownership of the mutex. If //! another thread already owns the mutex with exclusive ownership //! (scoped_lock), this thread will block until the mutex is released. @@ -104,7 +104,7 @@ class sharable_lock : mp_mutex(&m), m_locked(false) { m_locked = mp_mutex->try_lock_sharable(); } - //!Effects: m.timed_lock_sharable(abs_time) + //!Effects: m.timed_lock_sharable(abs_time) //!Postconditions: mutex() == &m. owns() == the return value of the //! m.timed_lock_sharable() executed within the constructor. //!Notes: The constructor will take sharable-ownership of the mutex if it @@ -132,7 +132,7 @@ class sharable_lock //! referenced mutex. //!Postconditions: mutex() == the value upgr.mutex() had before the construction. //! upgr.mutex() == 0 owns() == the value of upgr.owns() before construction. - //! upgr.owns() == false after the construction. + //! upgr.owns() == false after the construction. //!Notes: If upgr is locked, this constructor will lock this sharable_lock while //! unlocking upgr. Only a moved sharable_lock's will match this //! signature. An non-moved upgradable_lock can be moved with the expression: @@ -156,7 +156,7 @@ class sharable_lock //! scop.mutex() == 0 owns() == scop.owns() before the constructor. After the //! construction, scop.owns() == false. //!Notes: If scop is locked, this constructor will transfer the exclusive ownership - //! to a sharable-ownership of this sharable_lock. + //! to a sharable-ownership of this sharable_lock. //! Only a moved scoped_lock's will match this //! signature. An non-moved scoped_lock can be moved with the expression: //! "boost::move(lock);". @@ -184,12 +184,12 @@ class sharable_lock } //!Effects: If owns() before the call, then unlock_sharable() is called on mutex(). - //! *this gets the state of upgr and upgr gets set to a default constructed state. + //! *this gets the state of upgr and upgr gets set to a default constructed state. //!Notes: With a recursive mutex it is possible that both this and upgr own the mutex //! before the assignment. In this case, this will own the mutex after the assignment //! (and upgr will not), but the mutex's lock count will be decremented by one. sharable_lock &operator=(BOOST_RV_REF(sharable_lock<mutex_type>) upgr) - { + { if(this->owns()) this->unlock(); m_locked = upgr.owns(); @@ -203,7 +203,7 @@ class sharable_lock //!Notes: The sharable_lock changes from a state of not owning the //! mutex, to owning the mutex, blocking if necessary. void lock() - { + { if(!mp_mutex || m_locked) throw lock_exception(); mp_mutex->lock_sharable(); @@ -219,7 +219,7 @@ class sharable_lock //! mutex_type does not support try_lock_sharable(), this function will //! fail at compile time if instantiated, but otherwise have no effect. bool try_lock() - { + { if(!mp_mutex || m_locked) throw lock_exception(); m_locked = mp_mutex->try_lock_sharable(); @@ -236,7 +236,7 @@ class sharable_lock //! timed_lock_sharable(), this function will fail at compile time if //! instantiated, but otherwise have no effect. bool timed_lock(const boost::posix_time::ptime& abs_time) - { + { if(!mp_mutex || m_locked) throw lock_exception(); m_locked = mp_mutex->timed_lock_sharable(abs_time); @@ -282,7 +282,7 @@ class sharable_lock return mut; } - //!Effects: Swaps state with moved lock. + //!Effects: Swaps state with moved lock. //!Throws: Nothing. void swap(sharable_lock<mutex_type> &other) { |