getContext().getSafepointManager().pauseAllThreadsAndExecute(new Consumer<Boolean>() {
@Override
public void accept(Boolean isPausingThread) {
if (getContext().getThreadManager().getCurrentThread() == thread) {
throw new ThreadExitException();
}
}
});