#include <xmltooling/exceptions.h>
+#include <memory>
#include <signal.h>
namespace xmltooling
}
/**
+ * Locks and wraps the designated mutex.
+ *
+ * @param mtx mutex to lock
+ */
+ Lock(std::auto_ptr<Mutex>& mtx) : mutex(mtx.get()) {
+ if (mutex)
+ mutex->lock();
+ }
+
+ /**
* Unlocks the wrapped mutex.
*/
~Lock() {
}
/**
+ * 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(std::auto_ptr<RWLock>& lock, bool lockit=true) : rwlock(lock.get()) {
+ if (rwlock && lockit)
+ rwlock->rdlock();
+ }
+
+ /**
* Unlocks the wrapped shared lock.
*/
~SharedLock() {