changeset 1553:66c1988fc906

Use bqvec barrier
author Chris Cannam
date Thu, 11 Oct 2018 13:08:21 +0100
parents 05c3fbaec8ea
children 04a198887a3d
files base/RingBuffer.h
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/base/RingBuffer.h	Wed Oct 10 14:32:34 2018 +0100
+++ b/base/RingBuffer.h	Thu Oct 11 13:08:21 2018 +0100
@@ -18,13 +18,15 @@
    This file copyright 2000-2006 Chris Cannam.
 */
 
-#ifndef _RINGBUFFER_H_
-#define _RINGBUFFER_H_
+#ifndef SV_RINGBUFFER_H
+#define SV_RINGBUFFER_H
 
 #include <sys/types.h>
 
 #include "system/System.h"
 
+#include <bqvec/Barrier.h>
+
 #include <cstring> // memcpy, memset &c
 
 //#define DEBUG_RINGBUFFER 1
@@ -339,7 +341,7 @@
         memcpy(destination + here, m_buffer, (n - here) * sizeof(T));
     }
 
-    MBARRIER();
+    BQ_MBARRIER();
     m_readers[R] = (m_readers[R] + n) % m_size;
 
 #ifdef DEBUG_RINGBUFFER
@@ -382,7 +384,7 @@
         }
     }
 
-    MBARRIER();
+    BQ_MBARRIER();
     m_readers[R] = (m_readers[R] + n) % m_size;
     return n;
 }
@@ -405,7 +407,7 @@
         return t;
     }
     T value = m_buffer[m_readers[R]];
-    MBARRIER();
+    BQ_MBARRIER();
     if (++m_readers[R] == m_size) m_readers[R] = 0;
     return value;
 }
@@ -512,7 +514,7 @@
         memcpy(m_buffer, source + here, (n - here) * sizeof(T));
     }
 
-    MBARRIER();
+    BQ_MBARRIER();
     m_writer = (m_writer + n) % m_size;
 
 #ifdef DEBUG_RINGBUFFER
@@ -548,7 +550,7 @@
         memset(m_buffer, 0, (n - here) * sizeof(T));
     }
     
-    MBARRIER();
+    BQ_MBARRIER();
     m_writer = (m_writer + n) % m_size;
     return n;
 }