Test java/lang/management/ThreadMXBean/AllThreadIds.java uses Barrier to signal that thread has exited: 228 barrier.signal(); 229 } However, there is small window between call to .signal() and actual thread completion when main thread may observe wrong number of finished threads.
|