RFR: 8290059: Do not use std::thread in panama tests [v2]

Jorn Vernee jvernee at openjdk.org
Tue Jul 26 13:12:03 UTC 2022


On Sat, 23 Jul 2022 05:58:42 GMT, David Holmes <dholmes at openjdk.org> wrote:

> `run_async` is an odd name for this, especially as the fact you create then join mean it doesn't run asynchronously at all - it runs synchronously in another thread. 

I took the name from the CompleteableFuture API [1], although in that case a future is returned on which a user can call `get`. I can rename the function. Does `run_in_new_thread` seem good enough?

> The API would be more generally useful if you split the start and the join, but that would require also exposing an opaque thread "handle" (though splitting also means you don't have to try and think of a good name for `run_in_a_new_thread-and_join_it()` - you just have `threadStart` and `threadJoin`).

I can see this being useful in order to start many threads up front, and then join then all afterwards (to get them running concurrently). Though, I'd like to hold off on getting into that since the current tests don't need that functionality. The library header can be freely amended later as well.

[1] : https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/util/concurrent/CompletableFuture.html#runAsync(java.lang.Runnable)

-------------

PR: https://git.openjdk.org/jdk/pull/9599



More information about the build-dev mailing list