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

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

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

Unsafe.getAndSetInt介绍

[英]Atomically exchanges the given value with the current value of a field or array element within the given object o at the given offset.
[中]在给定[$1$]位置,将给定值与给定对象o中的字段或数组元素的当前值进行原子交换。

代码示例

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

public int getAndSetInt(final int index, final int value)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_INT);
  }
  return UNSAFE.getAndSetInt(byteArray, addressOffset + index, value);
}

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

public int getAndSetInt(final long index, final int value)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_INT);
  }
  return UNSAFE.getAndSetInt(null, addressOffset + index, value);
}

代码示例来源:origin: io.snappydata/gemfire-core

/**
 * {@inheritDoc}
 */
@Override
public final int getAndSet(T obj, int newValue) {
 return unsafe.getAndSetInt(obj, offset, newValue);
}

代码示例来源:origin: org.sincron/sincron-atomic

public int getAndSet(int update) {
    return UnsafeAccess.UNSAFE.getAndSetInt(this, OFFSET, update);
  }
}

代码示例来源:origin: org.sincron/sincron-atomic

public int getAndSet(int update) {
    return UnsafeAccess.UNSAFE.getAndSetInt(this, OFFSET, update);
  }
}

代码示例来源:origin: org.sincron/sincron-atomic

public int getAndSet(int update) {
    return UnsafeAccess.UNSAFE.getAndSetInt(this, OFFSET, update);
  }
}

代码示例来源:origin: org.sincron/sincron-atomic

public int getAndSet(int update) {
    return UnsafeAccess.UNSAFE.getAndSetInt(this, OFFSET, update);
  }
}

代码示例来源:origin: org.sincron/sincron-atomic

public int getAndSet(int update) {
    return UnsafeAccess.UNSAFE.getAndSetInt(this, OFFSET, update);
  }
}

代码示例来源:origin: org.sincron/sincron-atomic

public int getAndSet(int update) {
    return UnsafeAccess.UNSAFE.getAndSetInt(this, OFFSET, update);
  }
}

代码示例来源:origin: org.sincron/sincron-atomic

public int getAndSet(int update) {
    return UnsafeAccess.UNSAFE.getAndSetInt(this, OFFSET, update);
  }
}

代码示例来源:origin: serkan-ozal/mysafe

@Override
public int getAndSetInt(Unsafe unsafe, Object o, long offset, int newValue) {
  return unsafe.getAndSetInt(o, offset, newValue);
}

代码示例来源:origin: zeebe-io/zeebe

/** future is reusable after close */
public boolean close() {
 final int prevState = UNSAFE.getAndSetInt(this, STATE_OFFSET, CLOSED);
 if (prevState != CLOSED) {
  value = null;
  failure = null;
  failureCause = null;
  notifyBlockedTasks();
 }
 return prevState != CLOSED;
}

代码示例来源:origin: org.agrona/agrona

public int getAndSetInt(final int index, final int value)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_INT);
  }
  return UNSAFE.getAndSetInt(byteArray, addressOffset + index, value);
}

代码示例来源:origin: org.agrona/agrona

public int getAndSetInt(final long index, final int value)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_INT);
  }
  return UNSAFE.getAndSetInt(null, addressOffset + index, value);
}

代码示例来源:origin: uk.co.real-logic/Agrona

public int getAndSetInt(final int index, final int value)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_INT);
  }
  return UNSAFE.getAndSetInt(byteArray, addressOffset + index, value);
}

代码示例来源:origin: org.agrona/Agrona

public int getAndSetInt(final long index, final int value)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_INT);
  }
  return UNSAFE.getAndSetInt(null, addressOffset + index, value);
}

代码示例来源:origin: io.zeebe/zb-util

/** future is reusable after close */
public boolean close() {
 final int prevState = UNSAFE.getAndSetInt(this, STATE_OFFSET, CLOSED);
 if (prevState != CLOSED) {
  value = null;
  failure = null;
  failureCause = null;
  notifyBlockedTasks();
 }
 return prevState != CLOSED;
}

代码示例来源:origin: uk.co.real-logic/Agrona

public int getAndSetInt(final long index, final int value)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_INT);
  }
  return UNSAFE.getAndSetInt(null, addressOffset + index, value);
}

代码示例来源:origin: org.agrona/Agrona

public int getAndSetInt(final int index, final int value)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_INT);
  }
  return UNSAFE.getAndSetInt(byteArray, addressOffset + index, value);
}

代码示例来源:origin: org.deephacks.vals/vals

public int getAndSetInt(final int index, final int value) {
 boundsCheck(index, SIZE_OF_INT);
 return UNSAFE.getAndSetInt(byteArray, addressOffset + index, value);
}

相关文章

Unsafe类方法