Boost logo

Boost Users :

Subject: [Boost-users] Subject:[atomic] why atomic<>::store method can not support memory_order_consum memory_order_acquire and memory_order_acq_rel these memory_orders?
From: class7class_at_[hidden]
Date: 2015-07-21 22:43:41


Hello !

I am a SE and I program based on boost library, I have one question to ask as below:

When I use the atomic library included boost , I coded as following:
                  atomic<bool> flag; //declare the var
                  flag.store(true,boost::memory_order_acq_rel); // use store method to change the value of flag

but BOOST_ASSERT failed,and I read the code of base_atomic<> template class,I found the the store() method can not support several memory_orders metioned in the subject , and the other methods can not support all memory_orders,such as:
  1.the load method can not support memory_order_release and memory_order_acq_rel
  2. the compare_exchange_strong method can not support memory_order_release and memory_order_acq_rel
  3. the compare_exchange_weak method can not support memory_order_release and memory_order_acq_rel

I really want to know the reason that why the methods of atomic can not support all memory_orders.

If I need the methods of the atomic<> support all memory_orders,how can i do?

thank you very much!




class7class_at_[hidden]



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net