m4\acinclude.m4 = m4\acinclude.m4\r
m4\acx_pthread.m4 = m4\acx_pthread.m4\r
m4\ax_create_pkgconfig_info.m4 = m4\ax_create_pkgconfig_info.m4\r
- ..\cpp-sp-ext\m4\boost.m4 = ..\cpp-sp-ext\m4\boost.m4\r
+ m4\boost.m4 = m4\boost.m4\r
config_win32.h = config_win32.h\r
configure.ac = configure.ac\r
doxygen.am = doxygen.am\r
#include <xmltooling/exceptions.h>
#include <memory>
+#include <boost/scoped_ptr.hpp>
#include <signal.h>
namespace xmltooling
*
* @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();
}
* @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();
}