RFR: 8271513: support JavaThreadIteratorWithHandle replacement by new ThreadsList::Iterator [v2]
dholmes at openjdk.java.net
Tue Aug 3 02:09:33 UTC 2021
On Mon, 2 Aug 2021 11:13:54 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> src/hotspot/share/runtime/threadSMR.hpp line 331:
>>> 329: }
>>> 331: using Iterator = ThreadsList::Iterator;
>> Is this like a typedef? I don't think I want to see plain "Iterator" and not know what the actual type is here.
> It's a type alias, which in this simple form is just like a typedef. Type aliases can also have template parameters. The iterator type used for iterating over a ThreadsListHandle today happens to be the same type as used for iterating over the underlying ThreadsList. There's no particular reason to wire that information in to clients.
So `ThreadsListHandle::Iterator` is a global(?) alias for `ThreadsList::Iterator`?
If find this name/type aliasing somewhat obscure and confusing. I mean ideally the thing returned would just be an `Iterator` and the details of whether it is a `Foo::Iterator` or `Bar::Iterator` would not be evident in the API.
More information about the hotspot-runtime-dev