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

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

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

ForkJoinPool.tryExternalUnpush介绍

[英]Tries to pop the given task from submitter's queue in common pool.
[中]尝试从公用池中提交者的队列中弹出给定任务。

代码示例

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

/**
 * Tries to unschedule this task for execution. This method will
 * typically (but is not guaranteed to) succeed if this task is
 * the most recently forked task by the current thread, and has
 * not commenced executing in another thread.  This method may be
 * useful when arranging alternative local processing of tasks
 * that could have been, but were not, stolen.
 *
 * @return {@code true} if unforked
 */
public boolean tryUnfork() {
  Thread t;
  return (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
      ((ForkJoinWorkerThread)t).workQueue.tryUnpush(this) :
      ForkJoinPool.tryExternalUnpush(this));
}

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

/**
 * Tries to unschedule this task for execution. This method will
 * typically (but is not guaranteed to) succeed if this task is
 * the most recently forked task by the current thread, and has
 * not commenced executing in another thread.  This method may be
 * useful when arranging alternative local processing of tasks
 * that could have been, but were not, stolen.
 *
 * @return {@code true} if unforked
 */
public boolean tryUnfork() {
  Thread t;
  return (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
      ((ForkJoinWorkerThread)t).workQueue.tryUnpush(this) :
      ForkJoinPool.tryExternalUnpush(this));
}

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

/**
 * Tries to unschedule this task for execution. This method will
 * typically (but is not guaranteed to) succeed if this task is
 * the most recently forked task by the current thread, and has
 * not commenced executing in another thread.  This method may be
 * useful when arranging alternative local processing of tasks
 * that could have been, but were not, stolen.
 *
 * @return {@code true} if unforked
 */
public boolean tryUnfork() {
  Thread t;
  return (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
      ((ForkJoinWorkerThread)t).workQueue.tryUnpush(this) :
      ForkJoinPool.tryExternalUnpush(this));
}

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

/**
 * Tries to unschedule this task for execution. This method will
 * typically (but is not guaranteed to) succeed if this task is
 * the most recently forked task by the current thread, and has
 * not commenced executing in another thread.  This method may be
 * useful when arranging alternative local processing of tasks
 * that could have been, but were not, stolen.
 *
 * @return {@code true} if unforked
 */
public boolean tryUnfork() {
  Thread t;
  return (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
      ((ForkJoinWorkerThread)t).workQueue.tryUnpush(this) :
      ForkJoinPool.tryExternalUnpush(this));
}

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

/**
 * Tries to unschedule this task for execution. This method will
 * typically (but is not guaranteed to) succeed if this task is
 * the most recently forked task by the current thread, and has
 * not commenced executing in another thread.  This method may be
 * useful when arranging alternative local processing of tasks
 * that could have been, but were not, stolen.
 *
 * @return {@code true} if unforked
 */
public boolean tryUnfork() {
  Thread t;
  return (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
      ((ForkJoinWorkerThread)t).workQueue.tryUnpush(this) :
      ForkJoinPool.tryExternalUnpush(this));
}

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

/**
 * Tries to unschedule this task for execution. This method will
 * typically (but is not guaranteed to) succeed if this task is
 * the most recently forked task by the current thread, and has
 * not commenced executing in another thread.  This method may be
 * useful when arranging alternative local processing of tasks
 * that could have been, but were not, stolen.
 *
 * @return {@code true} if unforked
 */
public boolean tryUnfork() {
  Thread t;
  return (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
      ((ForkJoinWorkerThread)t).workQueue.tryUnpush(this) :
      ForkJoinPool.tryExternalUnpush(this));
}

代码示例来源:origin: hm.binkley/binkley-util

/**
 * Tries to unschedule this task for execution. This method will
 * typically (but is not guaranteed to) succeed if this task is
 * the most recently forked task by the current thread, and has
 * not commenced executing in another thread.  This method may be
 * useful when arranging alternative local processing of tasks
 * that could have been, but were not, stolen.
 *
 * @return {@code true} if unforked
 */
public boolean tryUnfork() {
  Thread t;
  return (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
      ((ForkJoinWorkerThread)t).workQueue.tryUnpush(this) :
      ForkJoinPool.common.tryExternalUnpush(this));
}

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

/**
 * Tries to unschedule this task for execution. This method will
 * typically (but is not guaranteed to) succeed if this task is
 * the most recently forked task by the current thread, and has
 * not commenced executing in another thread.  This method may be
 * useful when arranging alternative local processing of tasks
 * that could have been, but were not, stolen.
 *
 * @return {@code true} if unforked
 */
public boolean tryUnfork() {
  Thread t;
  return (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
      ((ForkJoinWorkerThread)t).workQueue.tryUnpush(this) :
      ForkJoinPool.tryExternalUnpush(this));
}

代码示例来源:origin: hm.binkley/binkley-util

/**
 * Blocks a non-worker-thread until completion or interruption.
 */
private int externalInterruptibleAwaitDone() throws InterruptedException {
  int s;
  if (Thread.interrupted())
    throw new InterruptedException();
  if ((s = status) >= 0 &&
    (s = ((this instanceof CountedCompleter) ?
       ForkJoinPool.common.externalHelpComplete(
         (CountedCompleter<?>)this, 0) :
       ForkJoinPool.common.tryExternalUnpush(this) ? doExec() :
       0)) >= 0) {
    while ((s = status) >= 0) {
      if (U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
        synchronized (this) {
          if (status >= 0)
            wait(0L);
          else
            notifyAll();
        }
      }
    }
  }
  return s;
}

代码示例来源:origin: hm.binkley/binkley-util

ForkJoinPool.common.externalHelpComplete(
       (CountedCompleter<?>)this, 0) :
     ForkJoinPool.common.tryExternalUnpush(this) ? doExec() : 0);
if (s >= 0 && (s = status) >= 0) {
  boolean interrupted = false;

代码示例来源:origin: hm.binkley/binkley-util

ForkJoinPool.common.externalHelpComplete(
        (CountedCompleter<?>)this, 0) :
      ForkJoinPool.common.tryExternalUnpush(this) ?
      doExec() : 0)) >= 0) {
long ns, ms; // measure in nanosecs, but wait in millisecs

相关文章

微信公众号

最新文章

更多

ForkJoinPool类方法