RFR: 8291714: Implement a Multi-Reader Single-Writer mutex for Hotspot [v5]
Thomas Stuefe
stuefe at openjdk.org
Thu Sep 8 16:16:36 UTC 2022
On Wed, 7 Sep 2022 09:09:52 GMT, Johan Sjölén <duke at openjdk.org> wrote:
> >To be clear, you will only ever get a null if someone passes it in explicitly as Thread::current_or_null() should never be able to return null in the contexts you would use this RWL.
>
>
>
> Context: UL uses static initialization for LogTagSets, these use the RWLock and as such our thread system isn't initialized yet. It's not strictly necessary, as we can re-write things to not require this.
>
>
>
> Edit: Perhaps the right decision is to simply delay the initialization of LogTagSets.
The early initialization of UL at lib load time is certainly a pain.
But there are other things too, other code running before initialisation, and then there is the case of non-attached threads and signal handling, etc.
I would be happy if this primitive was usable with Thread.current == Null. Otherwise you limit the future usefulness, and whatever code people use this lock in will also not be usable in these corner cases.
If it does not cost too much complexity.
-------------
PR: https://git.openjdk.org/jdk/pull/9838
More information about the hotspot-dev
mailing list