Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

线程状态转换图 #21

Open
diaosichengxuyuan opened this issue Feb 17, 2019 · 0 comments
Open

线程状态转换图 #21

diaosichengxuyuan opened this issue Feb 17, 2019 · 0 comments

Comments

@diaosichengxuyuan
Copy link
Owner

diaosichengxuyuan commented Feb 17, 2019

image

suspend:在调用后,线程不会释放已经占有的资源(比如锁),而是占有着资源进入睡眠状态,这样就容易引起死锁等不安全问题,线程进入等待状态。
stop:在终结一个线程的时候不会保证线程的资源正常释放,通常是没有给予线程完成资源释放工作的机会,因此会导致程序可能工作在不确定状态下,线程进入终止状态。
interrupt:设置中断标志位是true,然后线程监测中断标志位进行中断线程;如果线程处于“运行状态”,线程中断,中断标志位=true;如果线程处于“等待状态”,线程抛出中断异常,中断标志位=false;如果线程处于“阻塞状态”,线程无法中断,因此死锁不能被中断;Thread.isInterrupted()监测中断标志位;Thread.interrupted()监测并重置标志位=fasle。

作者原创,转载请注明出处,违法必究!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant