线程被中断意味着什么?

时间:2019-05-08 19:36:20

标签: java multithreading threadpool

说,我正在使用executorService在Java中生成多个线程,如下所示:

@ViewChild('myContainer', {read: ElementRef}) myContainer: ElementRef;
@Input() myUpdatingVar

ngOnChanges(): void {
  if (this.myContainer) {
    if (this.myUpdatingVar === someValue) {
       this.myFunc(this.someValue1);
     } else {
       this.myFunc(this.someValue2);
     }
   }
}

ngAfterViewInit() {
  this.ngOnChanges();
}

myFunc(param){
   do stuff....
   this.updateDom(anotherParam);
}

updateDom(param) {
// If I use setTimeout this works
this.myContainer.nativeElement.querySelector(`#someId`); // Undefined
}

在afterExecute中,我们使用的条件是!isShutdown()&&!Thread.currentThread()。isInterrupted()

我想知道在这里关闭线程或中断线程的含义是什么。在这种情况下,我们不执行runnable。对于进程关闭或中断,我认为其等效于CTRL +C。但是在线程中,它们只是进程内部的小部件。怎么会有Ctrl + C杀死了一个线程。

0 个答案:

没有答案