[cpp-xmltooling COMMIT] in /branches/REL_1: configure.ac cpp-xmltooling.sln xmltooling/util/Threads.h

noreply at shibboleth.net noreply at shibboleth.net
Thu Dec 29 22:55:08 GMT 2011


Author: scantor
Date: Thu Dec 29 22:55:08 2011
New Revision: 951

URL: http://svn.shibboleth.net/view/cpp-xmltooling?rev=951&view=rev
Log:
Add scoped_ptr support to Lock wrappers

Modified:
    branches/REL_1/configure.ac
    branches/REL_1/cpp-xmltooling.sln
    branches/REL_1/xmltooling/util/Threads.h

Modified: branches/REL_1/configure.ac
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/configure.ac?rev=951&r1=950&r2=951&view=diff
==============================================================================
--- branches/REL_1/configure.ac (original)
+++ branches/REL_1/configure.ac Thu Dec 29 22:55:08 2011
@@ -99,6 +99,7 @@
 BOOST_CONVERSION
 BOOST_LAMBDA
 BOOST_PTR_CONTAINER
+BOOST_SMART_PTR
 BOOST_STRING_ALGO
 BOOST_TOKENIZER
 CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"

Modified: branches/REL_1/cpp-xmltooling.sln
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/cpp-xmltooling.sln?rev=951&r1=950&r2=951&view=diff
==============================================================================
--- branches/REL_1/cpp-xmltooling.sln (original)
+++ branches/REL_1/cpp-xmltooling.sln Thu Dec 29 22:55:08 2011
@@ -6,7 +6,7 @@
 		m4\acinclude.m4 = m4\acinclude.m4
 		m4\acx_pthread.m4 = m4\acx_pthread.m4
 		m4\ax_create_pkgconfig_info.m4 = m4\ax_create_pkgconfig_info.m4
-		..\cpp-sp-ext\m4\boost.m4 = ..\cpp-sp-ext\m4\boost.m4
+		m4\boost.m4 = m4\boost.m4
 		config_win32.h = config_win32.h
 		configure.ac = configure.ac
 		doxygen.am = doxygen.am

Modified: branches/REL_1/xmltooling/util/Threads.h
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/util/Threads.h?rev=951&r1=950&r2=951&view=diff
==============================================================================
--- branches/REL_1/xmltooling/util/Threads.h (original)
+++ branches/REL_1/xmltooling/util/Threads.h Thu Dec 29 22:55:08 2011
@@ -30,6 +30,7 @@
 #include <xmltooling/exceptions.h>
 
 #include <memory>
+#include <boost/scoped_ptr.hpp>
 #include <signal.h>
 
 namespace xmltooling
@@ -310,7 +311,17 @@
          *
          * @param mtx mutex to lock
          */
-        Lock(std::auto_ptr<Mutex>& mtx) : mutex(mtx.get()) {
+        Lock(const std::auto_ptr<Mutex>& mtx) : mutex(mtx.get()) {
+            if (mutex)
+                mutex->lock();
+        }
+
+        /**
+         * Locks and wraps the designated mutex.
+         *
+         * @param mtx mutex to lock
+         */
+        Lock(const boost::scoped_ptr<Mutex>& mtx) : mutex(mtx.get()) {
             if (mutex)
                 mutex->lock();
         }
@@ -350,7 +361,18 @@
          * @param lock      lock to acquire
          * @param lockit    true if the lock should be acquired here, false if already acquired
          */
-        SharedLock(std::auto_ptr<RWLock>& lock, bool lockit=true) : rwlock(lock.get()) {
+        SharedLock(const std::auto_ptr<RWLock>& lock, bool lockit=true) : rwlock(lock.get()) {
+            if (rwlock && lockit)
+                rwlock->rdlock();
+        }
+
+        /**
+         * Locks and wraps the designated shared lock.
+         *
+         * @param lock      lock to acquire
+         * @param lockit    true if the lock should be acquired here, false if already acquired
+         */
+        SharedLock(const boost::scoped_ptr<RWLock>& lock, bool lockit=true) : rwlock(lock.get()) {
             if (rwlock && lockit)
                 rwlock->rdlock();
         }



More information about the commits mailing list