程序员大航子 2018-12-19 00:32 采纳率: 0%
浏览 792

为什么isInterrupted()方法, 之前执行了interrupted()方法, 就不行了。

// create a thread
        InterruptThread3 thread = new InterruptThread3();
        thread.start();

        thread.interrupt();

        // check current thread ---- main
        Assert.assertTrue("当前线程在中断的状态下", !Thread.interrupted());

        // check transfer thread ---- main ---- thread-A
      **  Assert.assertTrue("指定的线程不在中断的状态下", thread.isInterrupted());**

        // interrupt current thread ---- main
        Thread.currentThread().interrupt();

        Assert.assertTrue("当前线程不在中断的状态下", Thread.interrupted()); // resetting
        Assert.assertTrue("当前线程在中断的状态下", !Thread.interrupted());

为什么被星号引住那行过不去?

  • 写回答

1条回答 默认 最新

  • 关注

    过不去是什么意思?interrupted是是清除中断状态的,isInterrupted执行的话将返回false。

    评论

报告相同问题?

悬赏问题

  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波