1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 23:33:49 +01:00

Make const overload of ClientData::Site::ForEach usable

This commit is contained in:
Paul Licameli
2019-07-09 16:01:43 -04:00
parent 36cb2918be
commit d8b3d16554
2 changed files with 9 additions and 4 deletions

View File

@@ -57,19 +57,19 @@ template< typename Object > struct Lockable< Object, NoLocking >
: Object {
// implement trivial non-locking policy
struct Lock{};
Lock lock() { return {}; }
Lock lock() const { return {}; }
};
template< typename Object > struct Lockable< Object, NonrecursiveLocking >
: Object, std::mutex {
// implement real locking
using Lock = std::unique_lock< std::mutex >;
Lock lock() { return Lock{ *this }; }
Lock lock() const { return Lock{ *this }; }
};
template< typename Object > struct Lockable< Object, RecursiveLocking >
: Object, std::recursive_mutex {
// implement real locking
using Lock = std::unique_lock< std::recursive_mutex >;
Lock lock() { return Lock{ *this }; }
Lock lock() const { return Lock{ *this }; }
};
// Pairing of a reference to a Lockable and a lock on it