MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / ImplicitProducerKVP

Class ImplicitProducerKVP

concurrentqueue.h:3316–3342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3314 //////////////////////////////////
3315
3316 struct ImplicitProducerKVP
3317 {
3318 std::atomic<details::thread_id_t> key;
3319 ImplicitProducer* value; // No need for atomicity since it's only read by the thread that sets it in the first place
3320
3321 ImplicitProducerKVP() : value(nullptr) { }
3322
3323 ImplicitProducerKVP(ImplicitProducerKVP&& other) MOODYCAMEL_NOEXCEPT
3324 {
3325 key.store(other.key.load(std::memory_order_relaxed), std::memory_order_relaxed);
3326 value = other.value;
3327 }
3328
3329 inline ImplicitProducerKVP& operator=(ImplicitProducerKVP&& other) MOODYCAMEL_NOEXCEPT
3330 {
3331 swap(other);
3332 return *this;
3333 }
3334
3335 inline void swap(ImplicitProducerKVP& other) MOODYCAMEL_NOEXCEPT
3336 {
3337 if (this != &other) {
3338 details::swap_relaxed(key, other.key);
3339 std::swap(value, other.value);
3340 }
3341 }
3342 };
3343
3344 template<typename XT, typename XTraits>
3345 friend void moodycamel::swap(typename ConcurrentQueue<XT, XTraits>::ImplicitProducerKVP&, typename ConcurrentQueue<XT, XTraits>::ImplicitProducerKVP&) MOODYCAMEL_NOEXCEPT;

Callers

nothing calls this directly

Calls 1

swapFunction · 0.70

Tested by

no test coverage detected