diff options
Diffstat (limited to 'boost/lockfree')
-rw-r--r-- | boost/lockfree/detail/copy_payload.hpp | 9 | ||||
-rw-r--r-- | boost/lockfree/detail/freelist.hpp | 1 | ||||
-rw-r--r-- | boost/lockfree/spsc_queue.hpp | 10 |
3 files changed, 15 insertions, 5 deletions
diff --git a/boost/lockfree/detail/copy_payload.hpp b/boost/lockfree/detail/copy_payload.hpp index a1aff54f05..75b1b52a2b 100644 --- a/boost/lockfree/detail/copy_payload.hpp +++ b/boost/lockfree/detail/copy_payload.hpp @@ -12,6 +12,11 @@ #include <boost/mpl/if.hpp> #include <boost/type_traits/is_convertible.hpp> +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable: 4512) // assignment operator could not be generated +#endif + namespace boost { namespace lockfree { namespace detail { @@ -71,4 +76,8 @@ struct consume_noop }}} +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + #endif /* BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED */ diff --git a/boost/lockfree/detail/freelist.hpp b/boost/lockfree/detail/freelist.hpp index 739df08ee5..b053dce00c 100644 --- a/boost/lockfree/detail/freelist.hpp +++ b/boost/lockfree/detail/freelist.hpp @@ -466,6 +466,7 @@ public: { index_t index = tagged_index.get_index(); T * n = NodeStorage::nodes() + index; + (void)n; // silence msvc warning n->~T(); deallocate<ThreadSafe>(index); } diff --git a/boost/lockfree/spsc_queue.hpp b/boost/lockfree/spsc_queue.hpp index 444e681200..3fbbea7a86 100644 --- a/boost/lockfree/spsc_queue.hpp +++ b/boost/lockfree/spsc_queue.hpp @@ -86,7 +86,7 @@ protected: size_t read_available(size_t max_size) const { - size_t write_index = write_index_.load(memory_order_relaxed); + size_t write_index = write_index_.load(memory_order_acquire); const size_t read_index = read_index_.load(memory_order_relaxed); return read_available(write_index, read_index, max_size); } @@ -94,7 +94,7 @@ protected: size_t write_available(size_t max_size) const { size_t write_index = write_index_.load(memory_order_relaxed); - const size_t read_index = read_index_.load(memory_order_relaxed); + const size_t read_index = read_index_.load(memory_order_acquire); return write_available(write_index, read_index, max_size); } @@ -914,7 +914,7 @@ public: * * \return number of available elements that can be popped from the spsc_queue * - * \note Thread-safe and wait-free, should only be called from the producer thread + * \note Thread-safe and wait-free, should only be called from the consumer thread * */ size_type read_available() const { @@ -925,7 +925,7 @@ public: * * \return number of elements that can be pushed to the spsc_queue * - * \note Thread-safe and wait-free, should only be called from the consumer thread + * \note Thread-safe and wait-free, should only be called from the producer thread * */ size_type write_available() const { @@ -936,7 +936,7 @@ public: * * Availability of front element can be checked using read_available(). * - * \pre only one thread is allowed to check front element + * \pre only a consuming thread is allowed to check front element * \pre read_available() > 0. If ringbuffer is empty, it's undefined behaviour to invoke this method. * \return reference to the first element in the queue * |