提交 070b2cec authored 作者: Thomas Mueller's avatar Thomas Mueller

Ability to interrupt a thread

上级 00b69ed7
...@@ -94,6 +94,16 @@ public abstract class Task implements Runnable { ...@@ -94,6 +94,16 @@ public abstract class Task implements Runnable {
return finished; return finished;
} }
/**
* Interrupt the thread.
*/
public void interruptThread() {
if (thread == null) {
throw new IllegalStateException("Thread not started");
}
thread.interrupt();
}
/** /**
* Get the exception that was thrown in the call (if any). * Get the exception that was thrown in the call (if any).
* *
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论