@@ -46,8 +46,8 @@ namespace zldsp::container {
4646 * @return
4747 */
4848 int getNumReady () const {
49- const int current_head = head_.load (std::memory_order::relaxed );
50- const int current_tail = tail_.load (std::memory_order::acquire );
49+ const int current_head = head_.load ();
50+ const int current_tail = tail_.load ();
5151 if (current_tail >= current_head) {
5252 return current_tail - current_head;
5353 }
@@ -59,16 +59,16 @@ namespace zldsp::container {
5959 * @return
6060 */
6161 int getNumFree () const {
62- const int current_head = head_.load (std::memory_order::acquire );
63- const int current_tail = tail_.load (std::memory_order::relaxed );
62+ const int current_head = head_.load ();
63+ const int current_tail = tail_.load ();
6464 if (current_head > current_tail) {
6565 return current_head - current_tail - 1 ;
6666 }
6767 return capacity_ - current_tail + current_head - 1 ;
6868 }
6969
7070 void prepareToWrite (const int num_to_write, Range &range) const {
71- const int current_tail = tail_.load (std::memory_order::relaxed );
71+ const int current_tail = tail_.load ();
7272
7373 range.block_size1 = std::min (num_to_write, capacity_ - current_tail);
7474 range.start_index1 = current_tail;
@@ -84,14 +84,14 @@ namespace zldsp::container {
8484
8585 void finishedWrite (const int num_written) {
8686 if (num_written > 0 ) {
87- const int current_tail = tail_.load (std::memory_order::relaxed );
87+ const int current_tail = tail_.load ();
8888 const int new_tail = (current_tail + num_written) % capacity_;
89- tail_.store (new_tail, std::memory_order::release );
89+ tail_.store (new_tail);
9090 }
9191 }
9292
9393 void prepareToRead (const int num_to_read, Range &range) const {
94- const int current_head = head_.load (std::memory_order::relaxed );
94+ const int current_head = head_.load ();
9595
9696 range.block_size1 = std::min (num_to_read, capacity_ - current_head);
9797 range.start_index1 = current_head;
@@ -107,9 +107,9 @@ namespace zldsp::container {
107107
108108 void finishedRead (const int num_read) {
109109 if (num_read > 0 ) {
110- const int current_head = head_.load (std::memory_order::relaxed );
110+ const int current_head = head_.load ();
111111 const int new_head = (current_head + num_read) % capacity_;
112- head_.store (new_head, std::memory_order::release );
112+ head_.store (new_head);
113113 }
114114 }
115115
0 commit comments