- struct RegionLock {
- RegionLock (Playlist *pl, bool do_block_notify = true) : playlist (pl), block_notify (do_block_notify) {
- playlist->region_lock.lock();
- if (block_notify) {
- playlist->delay_notifications();
- }
- }
- ~RegionLock() {
- playlist->region_lock.unlock();
- if (block_notify) {
- playlist->release_notifications ();
- }
- }
- Playlist *playlist;
- bool block_notify;
- };
-
- friend class RegionLock;
-
- RegionListProperty regions; /* the current list of regions in the playlist */
+ class RegionReadLock : public Glib::Threads::RWLock::ReaderLock {
+ public:
+ RegionReadLock (Playlist *pl) : Glib::Threads::RWLock::ReaderLock (pl->region_lock) {}
+ ~RegionReadLock() {}
+ };
+
+ class RegionWriteLock : public Glib::Threads::RWLock::WriterLock {
+ public:
+ RegionWriteLock (Playlist *pl, bool do_block_notify = true)
+ : Glib::Threads::RWLock::WriterLock (pl->region_lock)
+ , playlist (pl)
+ , block_notify (do_block_notify) {
+ if (block_notify) {
+ playlist->delay_notifications();
+ }
+ }
+
+ ~RegionWriteLock() {
+ Glib::Threads::RWLock::WriterLock::release ();
+ if (block_notify) {
+ playlist->release_notifications ();
+ }
+ }
+ Playlist *playlist;
+ bool block_notify;
+ };
+
+ RegionListProperty regions; /* the current list of regions in the playlist */