Yet another spinlock init hack for g++8 std::atomics
authorRobin Gareus <robin@gareus.org>
Sun, 28 Jul 2019 16:37:57 +0000 (18:37 +0200)
committerRobin Gareus <robin@gareus.org>
Sun, 28 Jul 2019 16:39:26 +0000 (18:39 +0200)
Perhaps we should rather implement this ourselves,
using <boost/atomic.hpp>

libs/pbd/spinlock.cc

index 4dfc8132ffb99a6de324e34bec5ed82a4f6d683f..45e35daf370a458a8f33d06c96e7c7ee0f7dd62d 100644 (file)
 #include <malloc.h>
 #endif
 
+#include <cstring>
+
 #include "pbd/spinlock.h"
 
 using namespace PBD;
 
 spinlock_t::spinlock_t ()
 {
-       l = BOOST_DETAIL_SPINLOCK_INIT;
+       boost::detail::spinlock init = BOOST_DETAIL_SPINLOCK_INIT;
+       std::memcpy (&l, &init, sizeof (init));
 }
 
 SpinLock::SpinLock (spinlock_t& lock)