mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Make const overload of ClientData::Site::ForEach usable
This commit is contained in:
parent
36cb2918be
commit
d8b3d16554
@ -416,7 +416,12 @@ private:
|
||||
{
|
||||
return Locked< DataContainer >{ mData };
|
||||
}
|
||||
|
||||
|
||||
Locked<const DataContainer> GetData() const
|
||||
{
|
||||
return Locked< const DataContainer >{ mData };
|
||||
}
|
||||
|
||||
static void EnsureIndex( Locked<DataContainer> &data, size_t index )
|
||||
{
|
||||
if (data.mObject.size() <= index)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user