diff options
author | Robin Gareus <robin@gareus.org> | 2019-07-26 21:40:39 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-07-26 21:40:39 +0200 |
commit | 8a8468c5f15549469b79680be3b8a99478f4bab5 (patch) | |
tree | 2ddbd40519106d02718ce23eb0d997746fc067bf /libs | |
parent | 8a969b56c944c84d42b712fc8759b7d1f276e7da (diff) |
Correctly initialize spintlock_t
Depending on underlying implementation, boost::detail::spinlock
needs to be explicitly initialized
Diffstat (limited to 'libs')
-rw-r--r-- | libs/pbd/pbd/playback_buffer.h | 1 | ||||
-rw-r--r-- | libs/pbd/pbd/spinlock.h | 12 |
2 files changed, 11 insertions, 2 deletions
diff --git a/libs/pbd/pbd/playback_buffer.h b/libs/pbd/pbd/playback_buffer.h index d41adea2e2..53c9531d39 100644 --- a/libs/pbd/pbd/playback_buffer.h +++ b/libs/pbd/pbd/playback_buffer.h @@ -41,7 +41,6 @@ public: PlaybackBuffer (guint sz, guint res = 8191) : reservation (res) - , _reservation_lock () { sz += reservation; size = power_of_two_size (sz); diff --git a/libs/pbd/pbd/spinlock.h b/libs/pbd/pbd/spinlock.h index eb784ac6ce..41c40543f0 100644 --- a/libs/pbd/pbd/spinlock.h +++ b/libs/pbd/pbd/spinlock.h @@ -29,8 +29,18 @@ namespace PBD { * bool try_lock(); * void unlock(); * }; + * + * initialize with BOOST_DETAIL_SPINLOCK_INIT */ -typedef boost::detail::spinlock spinlock_t; +struct spinlock_t { +public: + spinlock_t () : l (BOOST_DETAIL_SPINLOCK_INIT) {}; + void lock () { l.lock (); } + void unlock () { l.unlock (); } + bool try_lock () { return l.try_lock (); } +private: + boost::detail::spinlock l; +}; /* RAII wrapper */ class LIBPBD_API SpinLock { |