Another try at C++11/boost spinlock initialization
authorRobin Gareus <robin@gareus.org>
Thu, 26 Sep 2019 00:47:16 +0000 (02:47 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 26 Sep 2019 00:48:17 +0000 (02:48 +0200)
libs/pbd/pbd/spinlock.h

index 44bc6c299b7452267151608c02798b911b6f4c10..3f4336ec56149827b4fd00ac63a715c50439a37c 100644 (file)
@@ -41,7 +41,7 @@ public:
        /* C++11 non-static data member initialization,
         * with non-copyable std::atomic ATOMIC_FLAG_INIT
         */
-       spinlock_t () : l {BOOST_DETAIL_SPINLOCK_INIT} {};
+       spinlock_t () {}
 #else
        /* default C++ assign struct's first member */
        spinlock_t ()
@@ -55,7 +55,11 @@ public:
        bool try_lock () { return l.try_lock (); }
 
 private:
+#ifdef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED
+       boost::detail::spinlock l = BOOST_DETAIL_SPINLOCK_INIT;
+#else
        boost::detail::spinlock l;
+#endif
 
        /* prevent copy construction */
        spinlock_t (const spinlock_t&);