|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65398 - in sandbox/sync/boost/sync: . locks
From: vicente.botet_at_[hidden]
Date: 2010-09-12 14:48:01
Author: viboes
Date: 2010-09-12 14:47:56 EDT (Sun, 12 Sep 2010)
New Revision: 65398
URL: http://svn.boost.org/trac/boost/changeset/65398
Log:
Added lock_guard
Added:
sandbox/sync/boost/sync/locks/
sandbox/sync/boost/sync/locks/lock_guard.hpp (contents, props changed)
Text files modified:
sandbox/sync/boost/sync/lockable_concepts.hpp | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Modified: sandbox/sync/boost/sync/lockable_concepts.hpp
==============================================================================
--- sandbox/sync/boost/sync/lockable_concepts.hpp (original)
+++ sandbox/sync/boost/sync/lockable_concepts.hpp 2010-09-12 14:47:56 EDT (Sun, 12 Sep 2010)
@@ -153,7 +153,7 @@
* unlock_and_lock_shared and unlock_upgrade_and_lock_shared functions
*/
-//[UpgradeLockableConcept
+//[UpgradeBasicLockableConcept
template <typename Lockable>
struct UpgradeBasicLockableConcept {
@@ -192,7 +192,7 @@
};
//]
-//[UpgradeLockableConcept
+//[UpgradeTimedLockableConcept
template <typename Lockable>
struct UpgradeTimedLockableConcept {
Added: sandbox/sync/boost/sync/locks/lock_guard.hpp
==============================================================================
--- (empty file)
+++ sandbox/sync/boost/sync/locks/lock_guard.hpp 2010-09-12 14:47:56 EDT (Sun, 12 Sep 2010)
@@ -0,0 +1,45 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright 2007 Anthony Williams
+// (C) Copyright Vicente J. Botet Escriba 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying fileLICENSE_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/sync for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNC_LOCK_GUARD_HPP
+#define BOOST_SYNC_LOCK_GUARD_HPP
+
+#include <boost/sync/lock_options.hpp>
+
+namespace boost {
+
+ template<typename Mutex>
+ class lock_guard
+ {
+ public:
+ typedef Mutex lockable_type;
+ explicit lock_guard(lockable_type& m_):
+ m(m_)
+ {
+ m.lock();
+ }
+ lock_guard(lockable_type& m_,adopt_lock_t):
+ m(m_)
+ {}
+ ~lock_guard()
+ {
+ m.unlock();
+ }
+ private:
+ lockable_type& m;
+
+ explicit lock_guard(lock_guard&);
+ lock_guard& operator=(lock_guard&);
+ };
+} // namespace boost{
+
+#endif // BOOST_SYNC_LOCK_GUARD_HPP
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk