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

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

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

Unsafe.fullFence介绍

[英]Ensures lack of reordering of loads or stores before the fence with loads or stores after the fence.
[中]确保围栏前的货物或仓库没有重新排序,围栏后的货物或仓库也没有重新排序。

代码示例

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

/**
 * Orders loads and stores before the fence, with loads and stores after the fence.
 */
public static void fullFence()
{
  unsafe.fullFence();
}

代码示例来源:origin: anba/es6draft

/**
 * Performs a full memory fence.
 * 
 * @see Unsafe#fullFence()
 */
static void fullFence() {
  UNSAFE.fullFence();
}

代码示例来源:origin: org.neo4j/neo4j-unsafe

/**
 * Orders loads and stores before the fence, with loads and stores after the fence.
 */
public static void fullFence()
{
  unsafe.fullFence();
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static void fullFence() {
  U.fullFence();
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public static void fullFence() {
  U.fullFence();
}

代码示例来源:origin: com.headius/unsafe-fences

public static void fullFence() {
  U.fullFence();
}

代码示例来源:origin: org.jruby/jruby-complete

/**
   * Update the given table table for the given object, using Unsafe fence or
   * volatile operations to ensure visibility.
   * 
   * @param self the object into which to set the variable
   * @param currentStamp the current variable table stamp
   * @param currentTable the current table
   * @param index the index of the variable
   * @param value the variable's value
   * @return whether the update was successful, for CAS retrying
   */
  private static boolean updateTableUnsafe(RubyBasicObject self, int currentStamp, Object[] currentTable, int index, Object value) {
    // shared access to varTable field.
    currentTable[index] = value;
    UnsafeHolder.U.fullFence();

    // validate stamp. redo on concurrent modification
    return self.varTableStamp == currentStamp;
  }
}

代码示例来源:origin: org.jruby/jruby-core

/**
   * Update the given table table for the given object, using Unsafe fence or
   * volatile operations to ensure visibility.
   * 
   * @param self the object into which to set the variable
   * @param currentStamp the current variable table stamp
   * @param currentTable the current table
   * @param index the index of the variable
   * @param value the variable's value
   * @return whether the update was successful, for CAS retrying
   */
  private static boolean updateTableUnsafe(RubyBasicObject self, int currentStamp, Object[] currentTable, int index, Object value) {
    // shared access to varTable field.
    currentTable[index] = value;
    UnsafeHolder.U.fullFence();

    // validate stamp. redo on concurrent modification
    return self.varTableStamp == currentStamp;
  }
}

代码示例来源:origin: Devexperts/lin-check

private static final void tlp_RemoteFreedChunksHead_add(
   long addrRemoteFreedChunksTail,
   long addrRemoteFreedChunk) {
  UNSAFE.putAddress(addrRemoteFreedChunk,NULL_ADDRESS);
//    UNSAFE.fullFence();
  long oldTail = UNSAFE.getAndSetLong(null,
    addrRemoteFreedChunksTail, addrRemoteFreedChunk);
  UNSAFE.putAddress(oldTail, addrRemoteFreedChunk);
  UNSAFE.fullFence();
 }

代码示例来源:origin: org.glassfish.jersey.bundles/jaxrs-ri

alloc = true;
} else {
  U.fullFence();                   // recheck
  int h = head, t = tail, size = t + 1 - h;
  if (cap >= size) {

代码示例来源:origin: org.glassfish.jersey.core/jersey-common

alloc = true;
} else {
  U.fullFence();                   // recheck
  int h = head, t = tail, size = t + 1 - h;
  if (cap >= size) {

代码示例来源:origin: eclipse-ee4j/jersey

alloc = true;
} else {
  U.fullFence();                   // recheck
  int h = head, t = tail, size = t + 1 - h;
  if (cap >= size) {

代码示例来源:origin: KostyaSha/yet-another-docker-plugin

alloc = true;
} else {
  U.fullFence();                   // recheck
  int h = head, t = tail, size = t + 1 - h;
  if (cap >= size) {

代码示例来源:origin: eclipse-ee4j/jersey

alloc = true;
} else {
  U.fullFence();                   // recheck
  int h = head, t = tail, size = t + 1 - h;
  if (cap >= size) {

代码示例来源:origin: Devexperts/lin-check

private static final long tlp_RemoteFreedChunksHead_remove(
  long addrRemoteFreedChunksHead,
  long addrRemoteFreedChunksTail,
  long addrRemoteFreedChunksDummy) {
 UNSAFE.loadFence();
 long head = UNSAFE.getAddress(addrRemoteFreedChunksHead);
 long v    = UNSAFE.getAddress(head);
 if (v!=NULL_ADDRESS) {
  long next = UNSAFE.getAddress(v);
  if (next==NULL_ADDRESS) {//v==tail(==getAddr(addrRemoteFreedChunksTail))
   if ( UNSAFE.compareAndSwapLong(null,
     addrRemoteFreedChunksTail,
     v,
     addrRemoteFreedChunksDummy) ) {
    return v;
   } else {
    return NULL_ADDRESS;
   }
  } else {
   UNSAFE.putAddress(head, next);
  }
  UNSAFE.fullFence();//
  return v;
 } else {
  return NULL_ADDRESS;
 }
}
//============================================================================

相关文章

微信公众号

最新文章

更多

Unsafe类方法