net.openhft.chronicle.bytes.Bytes.readVolatileLong()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.0k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中net.openhft.chronicle.bytes.Bytes.readVolatileLong()方法的一些代码示例,展示了Bytes.readVolatileLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.readVolatileLong()方法的具体详情如下:
包路径:net.openhft.chronicle.bytes.Bytes
类名称:Bytes
方法名:readVolatileLong

Bytes.readVolatileLong介绍

暂无

代码示例

代码示例来源:origin: peter-lawrey/Performance-Examples

public long getCount() {
    return bytes.readVolatileLong(COUNTER_OFFSET);
  }
}

代码示例来源:origin: net.openhft/chronicle-bytes

@Override
public long currentTimeMicros() {
  long time = provider.currentTimeMicros();
  while (true) {
    long time0 = bytes.readVolatileLong(LAST_TIME);
    if (time0 >= time)
      time = time0 + 1;
    if (bytes.compareAndSwapLong(LAST_TIME, time0, time))
      return time;
  }
}

代码示例来源:origin: net.openhft/chronicle-bytes

@Override
  public long currentTimeNanos() {
    long time = provider.currentTimeNanos();
    long time2 = time / 1000;
    while (true) {
      long time0 = bytes.readVolatileLong(LAST_TIME);
      if (time0 >= time2) {
        time = time2 + 1;
        time2 = time * 1000;
      }
      if (bytes.compareAndSwapLong(LAST_TIME, time0, time))
        return time;
    }
  }
}

相关文章

微信公众号

最新文章

更多