On Thu, 11 Aug 2022 08:26:12 GMT, Peter Levart <plev...@openjdk.org> wrote:
> Now that we have control over termination of carrier thread which can be > stopped at will without waiting for 30s or more, we can again test all cases > even with virtual threads... Yes, we can. I'll convert the test to run as a TestNG test and we can use a data provider for that. > test/jdk/jdk/internal/misc/TerminatingThreadLocal/TestTerminatingThreadLocal.java > line 145: > >> 143: // wait for carrier to terminate >> 144: Thread carrier = carrierRef.get(); >> 145: carrier.join(); > > ...would `close()`-ing the `pool` already guarantee that all pool thread(s) > are already stopped? `join()` would not be needed then. But the spec. only > talks about tasks that finish execution, not about threads... The close method waits for the all tasks to finish. There is a small window between task completion and the thread termination. ------------- PR: https://git.openjdk.org/jdk/pull/9819