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

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

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

ForkJoinPool.growSubmissionQueue介绍

[英]Creates or doubles submissionQueue array. Basically identical to ForkJoinWorkerThread version.
[中]创建或加倍submissionQueue数组。基本上与ForkJoinWorkerThread版本相同。

代码示例

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * Enqueues the given task in the submissionQueue.  Same idea as
 * ForkJoinWorkerThread.pushTask except for use of submissionLock.
 *
 * @param t the task
 */
private void addSubmission(ForkJoinTask<?> t) {
  final ReentrantLock lock = this.submissionLock;
  lock.lock();
  try {
    ForkJoinTask<?>[] q; int s, m;
    if ((q = submissionQueue) != null) {    // ignore if queue removed
      long u = (((s = queueTop) & (m = q.length-1)) << ASHIFT)+ABASE;
      UNSAFE.putOrderedObject(q, u, t);
      queueTop = s + 1;
      if (s - queueBase == m)
        growSubmissionQueue();
    }
  } finally {
    lock.unlock();
  }
  signalWork();
}

代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166

/**
 * Enqueues the given task in the submissionQueue.  Same idea as
 * ForkJoinWorkerThread.pushTask except for use of submissionLock.
 *
 * @param t the task
 */
private void addSubmission(ForkJoinTask<?> t) {
  final ReentrantLock lock = this.submissionLock;
  lock.lock();
  try {
    ForkJoinTask<?>[] q; int s, m;
    if ((q = submissionQueue) != null) {    // ignore if queue removed
      long u = (((s = queueTop) & (m = q.length-1)) << ASHIFT)+ABASE;
      UNSAFE.putOrderedObject(q, u, t);
      queueTop = s + 1;
      if (s - queueBase == m)
        growSubmissionQueue();
    }
  } finally {
    lock.unlock();
  }
  signalWork();
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Enqueues the given task in the submissionQueue.  Same idea as
 * ForkJoinWorkerThread.pushTask except for use of submissionLock.
 *
 * @param t the task
 */
private void addSubmission(ForkJoinTask<?> t) {
  final ReentrantLock lock = this.submissionLock;
  lock.lock();
  try {
    ForkJoinTask<?>[] q; int s, m;
    if ((q = submissionQueue) != null) {    // ignore if queue removed
      long u = (((s = queueTop) & (m = q.length-1)) << ASHIFT)+ABASE;
      UNSAFE.putOrderedObject(q, u, t);
      queueTop = s + 1;
      if (s - queueBase == m)
        growSubmissionQueue();
    }
  } finally {
    lock.unlock();
  }
  signalWork();
}

相关文章

ForkJoinPool类方法