@Override
   protected final long writeAcquire() {
      final long mask = this.mask;
      final long capacity = mask + 1;
      long consumerIndexCache = lpConsumerIndexCache();
      long currentProducerIndex;
      do {
         currentProducerIndex = lvProducerIndex(); // LoadLoad
         final long wrapPoint = currentProducerIndex - capacity;
         if (consumerIndexCache <= wrapPoint) {
            // update on stack copy, we might need this value again if we lose the CAS.
            consumerIndexCache = slowPathWriteAcquire(wrapPoint);
            if (consumerIndexCache == EOF) {
               return EOF;
            }
         }
      } while (!casProducerIndex(currentProducerIndex, currentProducerIndex + 1));
        /*
         * NOTE: the new producer index value is made visible BEFORE the element in the array. If we relied on
         * the index visibility to read it, we would need to handle the case where the element is not visible.
         */
      // Won CAS, move on to storing
      final long offsetForIndex = offsetForIndex(currentProducerIndex);
      // return offset for current producer index
      return offsetForIndex;
   }
This is to be used for an IPC queue with the direct buffer used being a memory mapped file.

@param buff
@param capacity
jctools-channels/src/main/java/org/jctools/channels/mpsc/MpscFFLamportOffHeapFixedSizeRingBuffer.java