Freeze in multi threaded app

Hmm,

maybe someone can enlighten me wether this is a bug in idea, the mac os x VM or just expected behavior.

I had a simple test application which creates a bunch of threads in public static void main. In order to monitor my threads I send the main thread via Thread.sleep(Long.MAX_VALUE) to sleep.

Interestingly this Thread.sleep prevents debugging of threads (#3265, Mac OS X, Single CPU and SMP). If I set a breakpoint in a thread the debugger will reach this breakpoint, and sit there forever collecting data. Step over/step into does not do anything.

Example: See attached file, set the breakpoint to the loop and run the test. If I switch from Thread.sleep() to wait() everything works as expected.

Any ideas?



Attachment(s):
TestClass.java

Please sign in to leave a comment.