本文整理了Java中java.util.concurrent.ForkJoinPool.tryHelpStealer()
方法的一些代码示例,展示了ForkJoinPool.tryHelpStealer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ForkJoinPool.tryHelpStealer()
方法的具体详情如下:
包路径:java.util.concurrent.ForkJoinPool
类名称:ForkJoinPool
方法名:tryHelpStealer
[英]Tries to locate and execute tasks for a stealer of the given task, or in turn one of its stealers, Traces currentSteal -> currentJoin links looking for a thread working on a descendant of the given task and with a non-empty queue to steal back and execute tasks from. The first call to this method upon a waiting join will often entail scanning/search, (which is OK because the joiner has nothing better to do), but this method leaves hints in workers to speed up subsequent calls. The implementation is very branchy to cope with potential inconsistencies or loops encountering chains that are stale, unknown, or so long that they are likely cyclic.
[中]尝试为给定任务的窃取程序定位和执行任务,或者反过来为其窃取程序之一跟踪currentSteal->currentJoin链接,查找在给定任务的子代上工作的线程,并使用非空队列从中窃取并执行任务。在等待连接时对该方法的第一次调用通常需要扫描/搜索(这是可以的,因为连接者没有更好的事情要做),但该方法会在worker中留下提示,以加快后续调用。实现非常简单,可以处理潜在的不一致性或遇到过时的、未知的或可能是循环的长链的循环。
代码示例来源:origin: robovm/robovm
(s = tryHelpStealer(joiner, task)) == 0) &&
(s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
代码示例来源:origin: robovm/robovm
/**
* Stripped-down variant of awaitJoin used by timed joins. Tries
* to help join only while there is continuous progress. (Caller
* will then enter a timed wait.)
*
* @param joiner the joining worker
* @param task the task
*/
final void helpJoinOnce(WorkQueue joiner, ForkJoinTask<?> task) {
int s;
if (joiner != null && task != null && (s = task.status) >= 0) {
ForkJoinTask<?> prevJoin = joiner.currentJoin;
joiner.currentJoin = task;
do {} while ((s = task.status) >= 0 && !joiner.isEmpty() &&
joiner.tryRemoveAndExec(task));
if (s >= 0 && (s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
if ((s = task.status) >= 0 &&
(task instanceof CountedCompleter))
s = helpComplete(task, LIFO_QUEUE);
}
if (s >= 0 && joiner.isEmpty()) {
do {} while (task.status >= 0 &&
tryHelpStealer(joiner, task) > 0);
}
joiner.currentJoin = prevJoin;
}
}
代码示例来源:origin: MobiVM/robovm
(s = tryHelpStealer(joiner, task)) == 0) &&
(s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
代码示例来源:origin: ibinti/bugvm
(s = tryHelpStealer(joiner, task)) == 0) &&
(s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
代码示例来源:origin: com.gluonhq/robovm-rt
(s = tryHelpStealer(joiner, task)) == 0) &&
(s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
(s = tryHelpStealer(joiner, task)) == 0) &&
(s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
代码示例来源:origin: MobiVM/robovm
/**
* Stripped-down variant of awaitJoin used by timed joins. Tries
* to help join only while there is continuous progress. (Caller
* will then enter a timed wait.)
*
* @param joiner the joining worker
* @param task the task
*/
final void helpJoinOnce(WorkQueue joiner, ForkJoinTask<?> task) {
int s;
if (joiner != null && task != null && (s = task.status) >= 0) {
ForkJoinTask<?> prevJoin = joiner.currentJoin;
joiner.currentJoin = task;
do {} while ((s = task.status) >= 0 && !joiner.isEmpty() &&
joiner.tryRemoveAndExec(task));
if (s >= 0 && (s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
if ((s = task.status) >= 0 &&
(task instanceof CountedCompleter))
s = helpComplete(task, LIFO_QUEUE);
}
if (s >= 0 && joiner.isEmpty()) {
do {} while (task.status >= 0 &&
tryHelpStealer(joiner, task) > 0);
}
joiner.currentJoin = prevJoin;
}
}
代码示例来源:origin: com.bugvm/bugvm-rt
(s = tryHelpStealer(joiner, task)) == 0) &&
(s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
代码示例来源:origin: FlexoVM/flexovm
(s = tryHelpStealer(joiner, task)) == 0) &&
(s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Stripped-down variant of awaitJoin used by timed joins. Tries
* to help join only while there is continuous progress. (Caller
* will then enter a timed wait.)
*
* @param joiner the joining worker
* @param task the task
*/
final void helpJoinOnce(WorkQueue joiner, ForkJoinTask<?> task) {
int s;
if (joiner != null && task != null && (s = task.status) >= 0) {
ForkJoinTask<?> prevJoin = joiner.currentJoin;
joiner.currentJoin = task;
do {} while ((s = task.status) >= 0 && !joiner.isEmpty() &&
joiner.tryRemoveAndExec(task));
if (s >= 0 && (s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
if ((s = task.status) >= 0 &&
(task instanceof CountedCompleter))
s = helpComplete(task, LIFO_QUEUE);
}
if (s >= 0 && joiner.isEmpty()) {
do {} while (task.status >= 0 &&
tryHelpStealer(joiner, task) > 0);
}
joiner.currentJoin = prevJoin;
}
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Stripped-down variant of awaitJoin used by timed joins. Tries
* to help join only while there is continuous progress. (Caller
* will then enter a timed wait.)
*
* @param joiner the joining worker
* @param task the task
*/
final void helpJoinOnce(WorkQueue joiner, ForkJoinTask<?> task) {
int s;
if (joiner != null && task != null && (s = task.status) >= 0) {
ForkJoinTask<?> prevJoin = joiner.currentJoin;
joiner.currentJoin = task;
do {} while ((s = task.status) >= 0 && !joiner.isEmpty() &&
joiner.tryRemoveAndExec(task));
if (s >= 0 && (s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
if ((s = task.status) >= 0 &&
(task instanceof CountedCompleter))
s = helpComplete(task, LIFO_QUEUE);
}
if (s >= 0 && joiner.isEmpty()) {
do {} while (task.status >= 0 &&
tryHelpStealer(joiner, task) > 0);
}
joiner.currentJoin = prevJoin;
}
}
代码示例来源:origin: ibinti/bugvm
/**
* Stripped-down variant of awaitJoin used by timed joins. Tries
* to help join only while there is continuous progress. (Caller
* will then enter a timed wait.)
*
* @param joiner the joining worker
* @param task the task
*/
final void helpJoinOnce(WorkQueue joiner, ForkJoinTask<?> task) {
int s;
if (joiner != null && task != null && (s = task.status) >= 0) {
ForkJoinTask<?> prevJoin = joiner.currentJoin;
joiner.currentJoin = task;
do {} while ((s = task.status) >= 0 && !joiner.isEmpty() &&
joiner.tryRemoveAndExec(task));
if (s >= 0 && (s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
if ((s = task.status) >= 0 &&
(task instanceof CountedCompleter))
s = helpComplete(task, LIFO_QUEUE);
}
if (s >= 0 && joiner.isEmpty()) {
do {} while (task.status >= 0 &&
tryHelpStealer(joiner, task) > 0);
}
joiner.currentJoin = prevJoin;
}
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Stripped-down variant of awaitJoin used by timed joins. Tries
* to help join only while there is continuous progress. (Caller
* will then enter a timed wait.)
*
* @param joiner the joining worker
* @param task the task
*/
final void helpJoinOnce(WorkQueue joiner, ForkJoinTask<?> task) {
int s;
if (joiner != null && task != null && (s = task.status) >= 0) {
ForkJoinTask<?> prevJoin = joiner.currentJoin;
joiner.currentJoin = task;
do {} while ((s = task.status) >= 0 && !joiner.isEmpty() &&
joiner.tryRemoveAndExec(task));
if (s >= 0 && (s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
if ((s = task.status) >= 0 &&
(task instanceof CountedCompleter))
s = helpComplete(task, LIFO_QUEUE);
}
if (s >= 0 && joiner.isEmpty()) {
do {} while (task.status >= 0 &&
tryHelpStealer(joiner, task) > 0);
}
joiner.currentJoin = prevJoin;
}
}
代码示例来源:origin: FlexoVM/flexovm
/**
* Stripped-down variant of awaitJoin used by timed joins. Tries
* to help join only while there is continuous progress. (Caller
* will then enter a timed wait.)
*
* @param joiner the joining worker
* @param task the task
*/
final void helpJoinOnce(WorkQueue joiner, ForkJoinTask<?> task) {
int s;
if (joiner != null && task != null && (s = task.status) >= 0) {
ForkJoinTask<?> prevJoin = joiner.currentJoin;
joiner.currentJoin = task;
do {} while ((s = task.status) >= 0 && !joiner.isEmpty() &&
joiner.tryRemoveAndExec(task));
if (s >= 0 && (s = task.status) >= 0) {
helpSignal(task, joiner.poolIndex);
if ((s = task.status) >= 0 &&
(task instanceof CountedCompleter))
s = helpComplete(task, LIFO_QUEUE);
}
if (s >= 0 && joiner.isEmpty()) {
do {} while (task.status >= 0 &&
tryHelpStealer(joiner, task) > 0);
}
joiner.currentJoin = prevJoin;
}
}
内容来源于网络,如有侵权,请联系作者删除!