本文整理汇总了Java中co.paralleluniverse.strands.Strand.unpark方法的典型用法代码示例。如果您正苦于以下问题:Java Strand.unpark方法的具体用法?Java Strand.unpark怎么用?Java Strand.unpark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类co.paralleluniverse.strands.Strand
的用法示例。
在下文中一共展示了Strand.unpark方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFrame
import co.paralleluniverse.strands.Strand; //导入方法依赖的package包/类
void onFrame(FrameUpdate frameUpdate) {
this.frame = frameUpdate.getFrame();
if (frame >= this.wakeUp) {
if (this.nextCommand != null) {
this.lastCommandReturnValue = this.nextCommand.execute();
if (this.lastCommandReturnValue) { // TODO this is not guaranteed to return the error related to the command
this.wakeUp = frame + this.nextCommand.getDelay();
} else {
BwError error = this.publicBoard.getInteractionHandler().getLastError();
logger.warn("{} failed with error probably being {}", this.nextCommand, error);
}
logger.trace("frame {}: {} executed {} ({})", frame, this.scv, this.nextCommand, this.lastCommandReturnValue ? "success" : "failed");
this.nextCommand = null;
Strand.unpark(this.getStrand());
}
}
this.sendOrInterrupt(frameUpdate);
}
示例2: signal
import co.paralleluniverse.strands.Strand; //导入方法依赖的package包/类
@Override
public void signal() {
final Strand t = waiter;
if (t != null){
Strand.unpark(t);
}
}
示例3: unpark
import co.paralleluniverse.strands.Strand; //导入方法依赖的package包/类
/**
* Makes available the permit for the given strand, if it
* was not already available. If the strand was blocked on
* {@code park} then it will unblock. Otherwise, its next call
* to {@code park} is guaranteed not to block. This operation
* is not guaranteed to have any effect at all if the given
* strand has not been started.
*
* @param strand the strand to unpark, or {@code null}, in which case this operation has no effect
*/
public static void unpark(Strand strand) {
Strand.unpark(strand);
}