本文整理了Java中java.util.concurrent.ForkJoinPool.tryPreBlock()
方法的一些代码示例,展示了ForkJoinPool.tryPreBlock()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ForkJoinPool.tryPreBlock()
方法的具体详情如下:
包路径:java.util.concurrent.ForkJoinPool
类名称:ForkJoinPool
方法名:tryPreBlock
[英]Tries to increment blockedCount, decrement active count (sometimes implicitly) and possibly release or create a compensating worker in preparation for blocking. Fails on contention or termination.
[中]尝试增加blockedCount,减少active count(有时是隐式的),并可能释放或创建一个补偿工作进程以准备阻塞。争用或终止时失败。
代码示例来源:origin: jtulach/bck2brwsr
/**
* Possibly blocks waiting for the given task to complete, or
* cancels the task if terminating. Fails to wait if contended.
*
* @param joinMe the task
*/
final void tryAwaitJoin(ForkJoinTask<?> joinMe) {
int s;
Thread.interrupted(); // clear interrupts before checking termination
if (joinMe.status >= 0) {
if (tryPreBlock()) {
joinMe.tryAwaitDone(0L);
postBlock();
}
else if ((ctl & STOP_BIT) != 0L)
joinMe.cancelIgnoringExceptions();
}
}
代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166
/**
* Possibly blocks waiting for the given task to complete, or
* cancels the task if terminating. Fails to wait if contended.
*
* @param joinMe the task
*/
final void tryAwaitJoin(ForkJoinTask<?> joinMe) {
int s;
Thread.interrupted(); // clear interrupts before checking termination
if (joinMe.status >= 0) {
if (tryPreBlock()) {
joinMe.tryAwaitDone(0L);
postBlock();
}
else if ((ctl & STOP_BIT) != 0L)
joinMe.cancelIgnoringExceptions();
}
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
/**
* Possibly blocks waiting for the given task to complete, or
* cancels the task if terminating. Fails to wait if contended.
*
* @param joinMe the task
*/
final void tryAwaitJoin(ForkJoinTask<?> joinMe) {
int s;
Thread.interrupted(); // clear interrupts before checking termination
if (joinMe.status >= 0) {
if (tryPreBlock()) {
joinMe.tryAwaitDone(0L);
postBlock();
}
else if ((ctl & STOP_BIT) != 0L)
joinMe.cancelIgnoringExceptions();
}
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
break;
if (tryPreBlock()) {
long last = System.nanoTime();
while (joinMe.status >= 0) {
代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166
break;
if (tryPreBlock()) {
long last = System.nanoTime();
while (joinMe.status >= 0) {
代码示例来源:origin: jtulach/bck2brwsr
break;
if (tryPreBlock()) {
long last = System.nanoTime();
while (joinMe.status >= 0) {
代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166
/**
* If necessary, compensates for blocker, and blocks
*/
private void awaitBlocker(ManagedBlocker blocker)
throws InterruptedException {
while (!blocker.isReleasable()) {
if (tryPreBlock()) {
try {
do {} while (!blocker.isReleasable() && !blocker.block());
} finally {
postBlock();
}
break;
}
}
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
/**
* If necessary, compensates for blocker, and blocks
*/
private void awaitBlocker(ManagedBlocker blocker)
throws InterruptedException {
while (!blocker.isReleasable()) {
if (tryPreBlock()) {
try {
do {} while (!blocker.isReleasable() && !blocker.block());
} finally {
postBlock();
}
break;
}
}
}
代码示例来源:origin: jtulach/bck2brwsr
/**
* If necessary, compensates for blocker, and blocks
*/
private void awaitBlocker(ManagedBlocker blocker)
throws InterruptedException {
while (!blocker.isReleasable()) {
if (tryPreBlock()) {
try {
do {} while (!blocker.isReleasable() && !blocker.block());
} finally {
postBlock();
}
break;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!