Fixup return types

This commit is contained in:
Atlante45 2015-11-10 18:39:59 -08:00
parent d5c44466c4
commit 65e9dc4be5

View file

@ -21,7 +21,7 @@ class ReadWriteLockable {
public: public:
// Write locks // Write locks
template <typename F> template <typename F>
bool withWriteLock(F&& f) const; void withWriteLock(F&& f) const;
template <typename F> template <typename F>
bool withWriteLock(F&& f, bool require) const; bool withWriteLock(F&& f, bool require) const;
@ -34,7 +34,7 @@ public:
// Read locks // Read locks
template <typename F> template <typename F>
bool withReadLock(F&& f) const; void withReadLock(F&& f) const;
template <typename F> template <typename F>
bool withReadLock(F&& f, bool require) const; bool withReadLock(F&& f, bool require) const;
@ -51,16 +51,16 @@ private:
// ReadWriteLockable // ReadWriteLockable
template <typename F> template <typename F>
inline bool ReadWriteLockable::withWriteLock(F&& f) const { inline void ReadWriteLockable::withWriteLock(F&& f) const {
QWriteLocker locker(&_lock); QWriteLocker locker(&_lock);
f(); f();
return true;
} }
template <typename F> template <typename F>
inline bool ReadWriteLockable::withWriteLock(F&& f, bool require) const { inline bool ReadWriteLockable::withWriteLock(F&& f, bool require) const {
if (require) { if (require) {
return withWriteLock(std::forward<F>(f)); withWriteLock(std::forward<F>(f));
return true;
} else { } else {
return withTryReadLock(std::forward<F>(f)); return withTryReadLock(std::forward<F>(f));
} }
@ -87,16 +87,16 @@ inline bool ReadWriteLockable::withTryWriteLock(F&& f, int timeout) const {
} }
template <typename F> template <typename F>
inline bool ReadWriteLockable::withReadLock(F&& f) const { inline void ReadWriteLockable::withReadLock(F&& f) const {
QReadLocker locker(&_lock); QReadLocker locker(&_lock);
f(); f();
return true;
} }
template <typename F> template <typename F>
inline bool ReadWriteLockable::withReadLock(F&& f, bool require) const { inline bool ReadWriteLockable::withReadLock(F&& f, bool require) const {
if (require) { if (require) {
return withReadLock(std::forward<F>(f)); withReadLock(std::forward<F>(f));
return true;
} else { } else {
return withTryReadLock(std::forward<F>(f)); return withTryReadLock(std::forward<F>(f));
} }