From d98c8e8fa4bb18cbbf2a18b82b11d9949bb00890 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 22 Oct 2009 16:15:36 +0000 Subject: Replace horribly error-prone Sequence/MidiModel/MidiSource locking API with scoped locks that automatically Do The Right Thing. Make Sequence::read_lock const correct in the process (a read lock can be taken out on a const Sequence, but not a write lock). git-svn-id: svn://localhost/ardour2/branches/3.0@5857 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/midi_model.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libs/ardour/ardour/midi_model.h') diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 6496fd169a..cebc435435 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -165,6 +165,21 @@ public: boost::shared_ptr > find_note (boost::shared_ptr >); +private: + struct WriteLockImpl : public AutomatableSequence::WriteLockImpl { + WriteLockImpl(Glib::Mutex::Lock* source_lock, Glib::RWLock& s, Glib::Mutex& c) + : AutomatableSequence::WriteLockImpl(s, c) + , source_lock(source_lock) + {} + ~WriteLockImpl() { + delete source_lock; + } + Glib::Mutex::Lock* source_lock; + }; + +public: + virtual WriteLock write_lock(); + private: friend class DeltaCommand; -- cgit v1.2.3