sun.misc.Unsafe.putLongVolatile()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(182)

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

Unsafe.putLongVolatile介绍

[英]Stores a long field into the given object, using volatile semantics.
[中]使用volatile语义将long字段存储到给定对象中。

代码示例

代码示例来源:origin: LMAX-Exchange/disruptor

/**
 * Performs a volatile write of this sequence.  The intent is
 * a Store/Store barrier between this write and any previous
 * write and a Store/Load barrier between this write and any
 * subsequent volatile read.
 *
 * @param value The new value for the sequence.
 */
public void setVolatile(final long value)
{
  UNSAFE.putLongVolatile(this, VALUE_OFFSET, value);
}

代码示例来源:origin: redisson/redisson

@Override
public void putLongVolatile(long byteIndex, long l) {
  unsafe.putLongVolatile(null, baseAdress + byteIndex, l);
}

代码示例来源:origin: redisson/redisson

@Override
public void putLongVolatile(long byteIndex, long l) {
  unsafe.putLongVolatile(base, off + byteIndex, l);
}

代码示例来源:origin: neo4j/neo4j

public static void putLongVolatile( Object obj, long offset, long value )
{
  unsafe.putLongVolatile( obj, offset, value );
}

代码示例来源:origin: apache/ignite

/**
 * Stores long value with volatile semantic.
 *
 * @param obj Object.
 * @param off Offset.
 * @param val Value.
 */
public static void putLongVolatile(Object obj, long off, long val) {
  UNSAFE.putLongVolatile(obj, off, val);
}

代码示例来源:origin: real-logic/agrona

/**
 * Set the counter with volatile semantics.
 *
 * @param value to be set with volatile semantics.
 */
public void set(final long value)
{
  UnsafeAccess.UNSAFE.putLongVolatile(byteArray, addressOffset, value);
}

代码示例来源:origin: JCTools/JCTools

protected final void svSequenceElement(long offset, long e) {
  UNSAFE.putLongVolatile(sequenceBuffer, offset, e);
}

代码示例来源:origin: real-logic/agrona

public void setVolatile(final long value)
{
  UnsafeAccess.UNSAFE.putLongVolatile(byteArray, addressOffset, value);
}

代码示例来源:origin: JCTools/JCTools

protected final void svSequenceElement(long[] buffer, long offset, long e) {
  UNSAFE.putLongVolatile(buffer, offset, e);
}

代码示例来源:origin: RuedigerMoeller/fast-serialization

@Override
public void putLongVolatile(long byteIndex, long l) {
  unsafe.putLongVolatile(null, baseAdress + byteIndex, l);
}

代码示例来源:origin: apache/geode

public void putLongVolatile(Object o, long offset, long v) {
 this.unsafe.putLongVolatile(o, offset, v);
}

代码示例来源:origin: RuedigerMoeller/fast-serialization

@Override
public void putLongVolatile(long byteIndex, long l) {
  unsafe.putLongVolatile(base, off + byteIndex, l);
}

代码示例来源:origin: fengjiachun/Jupiter

public void putLongVolatile(Object target, long offset, long value) {
  unsafe.putLongVolatile(target, offset, value);
}

代码示例来源:origin: fengjiachun/Jupiter

public void putLongVolatile(Object target, long offset, long value) {
  unsafe.putLongVolatile(target, offset, value);
}

代码示例来源:origin: neo4j/neo4j

public static void putLongVolatile( long address, long value )
{
  checkAccess( address, Long.BYTES );
  unsafe.putLongVolatile( null, address, value );
}

代码示例来源:origin: robovm/robovm

/**
 * Sets the element at position {@code i} to the given value.
 *
 * @param i the index
 * @param newValue the new value
 */
public final void set(int i, long newValue) {
  unsafe.putLongVolatile(array, checkedByteOffset(i), newValue);
}

代码示例来源:origin: real-logic/agrona

public void putLongVolatile(final long index, final long value)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_LONG);
  }
  UNSAFE.putLongVolatile(null, addressOffset + index, value);
}

代码示例来源:origin: real-logic/agrona

public void putLongVolatile(final int index, final long value)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_LONG);
  }
  UNSAFE.putLongVolatile(byteArray, addressOffset + index, value);
}

代码示例来源:origin: robovm/robovm

public void set(T obj, long newValue) {
  if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj);
  unsafe.putLongVolatile(obj, offset, newValue);
}

代码示例来源:origin: real-logic/agrona

/**
 * Create a new queue with a bounded capacity. The requested capacity will be rounded up to the next positive
 * power of two in size. That is if you request a capacity of 1000 then you will get 1024. If you request 1024
 * then that is what you will get.
 *
 * @param requestedCapacity of the queue which must be >= 2.
 * @throws IllegalArgumentException if the requestedCapacity < 2.
 */
public ManyToManyConcurrentArrayQueue(final int requestedCapacity)
{
  super(requestedCapacity);
  if (requestedCapacity < 2)
  {
    throw new IllegalArgumentException(
      "requestedCapacity must be >= 2: requestedCapacity=" + requestedCapacity);
  }
  final long[] sequences = new long[capacity];
  for (int i = 0; i < capacity; i++)
  {
    sequences[i] = i;
  }
  UNSAFE.putLongVolatile(sequences, sequenceArrayOffset(0, sequences.length - 1), 0);
  this.sequences = sequences;
}

相关文章

Unsafe类方法