| 3278 | ////////////////////////////////// |
| 3279 | |
| 3280 | struct ImplicitProducerKVP |
| 3281 | { |
| 3282 | std::atomic<details::thread_id_t> key; |
| 3283 | ImplicitProducer* value; // No need for atomicity since it's only read by the thread that sets it in the first place |
| 3284 | |
| 3285 | ImplicitProducerKVP() : value(nullptr) { } |
| 3286 | |
| 3287 | ImplicitProducerKVP(ImplicitProducerKVP&& other) MOODYCAMEL_NOEXCEPT |
| 3288 | { |
| 3289 | key.store(other.key.load(std::memory_order_relaxed), std::memory_order_relaxed); |
| 3290 | value = other.value; |
| 3291 | } |
| 3292 | |
| 3293 | inline ImplicitProducerKVP& operator=(ImplicitProducerKVP&& other) MOODYCAMEL_NOEXCEPT |
| 3294 | { |
| 3295 | swap(other); |
| 3296 | return *this; |
| 3297 | } |
| 3298 | |
| 3299 | inline void swap(ImplicitProducerKVP& other) MOODYCAMEL_NOEXCEPT |
| 3300 | { |
| 3301 | if (this != &other) { |
| 3302 | details::swap_relaxed(key, other.key); |
| 3303 | std::swap(value, other.value); |
| 3304 | } |
| 3305 | } |
| 3306 | }; |
| 3307 | |
| 3308 | template<typename XT, typename XTraits> |
| 3309 | friend void moodycamel::swap(typename ConcurrentQueue<XT, XTraits>::ImplicitProducerKVP&, typename ConcurrentQueue<XT, XTraits>::ImplicitProducerKVP&) MOODYCAMEL_NOEXCEPT; |