当前位置: 首页>>代码示例>>Java>>正文


Java NativeUnsafe.setUnalignedLong方法代码示例

本文整理汇总了Java中com.sun.squawk.NativeUnsafe.setUnalignedLong方法的典型用法代码示例。如果您正苦于以下问题:Java NativeUnsafe.setUnalignedLong方法的具体用法?Java NativeUnsafe.setUnalignedLong怎么用?Java NativeUnsafe.setUnalignedLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.squawk.NativeUnsafe的用法示例。


在下文中一共展示了NativeUnsafe.setUnalignedLong方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setLong

import com.sun.squawk.NativeUnsafe; //导入方法依赖的package包/类
/**
 * Sets the <code>long</code> at the given offset in the memory area
 *  associated with this object.
 *  Even if it is aligned, the long value may not be updated atomically.  It is unspecified how many
 *  load and store operations will be used or in what order.
 *  <p>
 *  This memory access may involve multiple load and a store operations, and it may have unspecified
 *  effects on surrounding bytes (even bytes in the range being stored)
 *  in the presence of concurrent access.
 * <p>
 *  Caching of the memory access is controlled by the memory <code>type</code> requested
 *  when the <code>RawMemoryAccess</code> instance was created.  If the memory is not cached,
 *  this method guarantees serialized access (that is, the memory access at the memory
 *  occurs in the same order as in the program.  Multiple writes to the same location
 *  may not be coalesced.)
 *
 * @param offset The offset in bytes from the beginning of the raw memory area
 *       at which to write the long.
 *
 * @param value The long to write.
 *
 * @throws OffsetOutOfBoundsException Thrown if the offset is negative or greater than the size of the
 *      raw memory area.  The role of the {@link SizeOutOfBoundsException} somewhat overlaps
 *      this exception since it is thrown if the offset is within the object but outside the
 *      mapped area. (See {@link RawMemoryAccess#map(long base, long size)}).
 *
 * @throws SizeOutOfBoundsException  Thrown if the object is not mapped,
 *      or if the long falls in an invalid address range.
 *
 * @throws java.lang.SecurityException Thrown if this access is
 * not permitted by the security manager.
 */
public void setLong(long offset, long value) {
    int off = (int)offset;
    checkWrite(off, 8);
    NativeUnsafe.setUnalignedLong(vbase, off, value);

}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:39,代码来源:RawMemoryAccess.java


注:本文中的com.sun.squawk.NativeUnsafe.setUnalignedLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。