[cpp-xmltooling COMMIT] /branches/REL_1/xmltooling/util/Threads.h
noreply at shibboleth.net
noreply at shibboleth.net
Wed Jan 4 22:38:00 GMT 2012
Author: scantor
Date: Wed Jan 4 22:38:00 2012
New Revision: 952
URL: http://svn.shibboleth.net/view/cpp-xmltooling?rev=952&view=rev
Log:
Add release methods to Lock wrappers
Modified:
branches/REL_1/xmltooling/util/Threads.h
Modified: branches/REL_1/xmltooling/util/Threads.h
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/util/Threads.h?rev=952&r1=951&r2=952&view=diff
==============================================================================
--- branches/REL_1/xmltooling/util/Threads.h (original)
+++ branches/REL_1/xmltooling/util/Threads.h Wed Jan 4 22:38:00 2012
@@ -327,13 +327,24 @@
}
/**
- * Unlocks the wrapped mutex.
+ * Unlocks the wrapped mutex, if any.
*/
~Lock() {
if (mutex)
mutex->unlock();
}
+ /**
+ * Releases control of the original Mutex and returns it without unlocking it.
+ *
+ * @return the original, locked Mutex
+ */
+ Mutex* release() {
+ Mutex* ret = mutex;
+ mutex = nullptr;
+ return ret;
+ }
+
private:
Mutex* mutex;
};
@@ -378,13 +389,24 @@
}
/**
- * Unlocks the wrapped shared lock.
+ * Unlocks the wrapped shared lock, if any.
*/
~SharedLock() {
if (rwlock)
rwlock->unlock();
}
+ /**
+ * Releases control of the original shared lock and returns it without unlocking it.
+ *
+ * @return the original shared lock
+ */
+ RWLock* release() {
+ RWLock* ret = rwlock;
+ rwlock = nullptr;
+ return ret;
+ }
+
private:
RWLock* rwlock;
};
More information about the commits
mailing list