Does a breakpoint halt all threads?

半腔热情 提交于 2019-12-17 16:25:00

问题


If I have two threads running concurrently in my program and put a breakpoint on one of them, will the other thread stop also halt when this breakpoint is hit, or will it continue executing regardless?

(I am writing in Java and using NetBeans)


回答1:


Breakpoints have an option how they should behave: to suspend a single thread or all threads




回答2:


I believe that each thread will stop once it hits the breakpoint in the code, while other threads will continue to run. I remember this from my Tomcat days.




回答3:


By default only the thread that hits the breakpoint stops. However, you can modify the behavior by changing the breakpopint properties.




回答4:


It might be interesting to note that in Eclipse and NetBeans the default behavior is to suspend the current thread when the breakpoint is hit, while in IntelliJ it suspends all threads.



来源:https://stackoverflow.com/questions/8174408/does-a-breakpoint-halt-all-threads

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!