Correctly initialize spintlock_t
Depending on underlying implementation, boost::detail::spinlock needs to be explicitly initialized
This commit is contained in:
parent
8a969b56c9
commit
8a8468c5f1
@ -41,7 +41,6 @@ public:
|
||||
|
||||
PlaybackBuffer (guint sz, guint res = 8191)
|
||||
: reservation (res)
|
||||
, _reservation_lock ()
|
||||
{
|
||||
sz += reservation;
|
||||
size = power_of_two_size (sz);
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user