Java多線程與併發 --- interrupt 函數

interrupt 函數 如何中斷線程? 已經被拋棄的方法: 一、通過調用 stop()方法停止線程 stop 太過於暴力且不安全的,使得被停止的線程來不及清理,會馬上釋放鎖,引發數據不同步的問題 二、suspend() 方法 resume ()方法 目前使用的方法: 一、interrupt (),通知線程應該中斷了   public class InterruptDemo { public st
相關文章
相關標籤/搜索