What does `std::kill_dependency` do, and why would I want to use it?

后端 未结 4 1034
鱼传尺愫
鱼传尺愫 2020-12-12 20:31

I\'ve been reading about the new C++11 memory model and I\'ve come upon the std::kill_dependency function (§29.3/14-15). I\'m struggling to understand why

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-12 20:56

    My guess is that it enables this optimization.

    r1 = x.load(memory_order_consume);
    do_something_with(a[r1->index]);
    

提交回复
热议问题