java.util.concurrent.ForkJoinPool.acquirePlock()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(85)

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

ForkJoinPool.acquirePlock介绍

[英]Acquires the plock lock to protect worker array and related updates. This method is called only if an initial CAS on plock fails. This acts as a spinlock for normal cases, but falls back to builtin monitor to block when (rarely) needed. This would be a terrible idea for a highly contended lock, but works fine as a more conservative alternative to a pure spinlock.
[中]获取plock锁以保护工作阵列和相关更新。只有当plock上的初始CAS失败时,才会调用此方法。这在正常情况下起到旋转锁的作用,但在(很少)需要时会退回到内置监视器来阻止。对于高度竞争的锁来说,这是一个糟糕的想法,但作为纯自旋锁的一个更保守的替代方案,它可以很好地工作。

代码示例

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

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
if (!U.compareAndSwapInt(this, PLOCK, ps, SHUTDOWN))
  releasePlock(SHUTDOWN);

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

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
if (((ws = workQueues) == null || ws.length == 0) && nws != null)
  workQueues = nws;

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

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
try {

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

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
try {

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

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
if ((ws = workQueues) != null && k < ws.length && ws[k] == null)
  ws[k] = q;

代码示例来源:origin: ibinti/bugvm

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
if (((ws = workQueues) == null || ws.length == 0) && nws != null)
  workQueues = nws;

代码示例来源:origin: FlexoVM/flexovm

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
if (((ws = workQueues) == null || ws.length == 0) && nws != null)
  workQueues = nws;

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

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
if (((ws = workQueues) == null || ws.length == 0) && nws != null)
  workQueues = nws;

代码示例来源:origin: com.gluonhq/robovm-rt

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
if (((ws = workQueues) == null || ws.length == 0) && nws != null)
  workQueues = nws;

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
if (((ws = workQueues) == null || ws.length == 0) && nws != null)
  workQueues = nws;

代码示例来源:origin: com.bugvm/bugvm-rt

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
if (((ws = workQueues) == null || ws.length == 0) && nws != null)
  workQueues = nws;

代码示例来源:origin: ibinti/bugvm

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
try {

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

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
try {

代码示例来源:origin: com.bugvm/bugvm-rt

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
try {

代码示例来源:origin: FlexoVM/flexovm

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
try {

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
try {

代码示例来源:origin: com.gluonhq/robovm-rt

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
try {

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

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
try {

代码示例来源:origin: com.gluonhq/robovm-rt

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN);
try {

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

if (((ps = plock) & PL_LOCK) != 0 ||
  !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK))
  ps = acquirePlock();
if ((ws = workQueues) != null && k < ws.length && ws[k] == null)
  ws[k] = q;

相关文章

微信公众号

最新文章

更多

ForkJoinPool类方法