Skip to content

Commit 3579024

Browse files
jdksjolenDavid Holmes
authored and
David Holmes
committed
8288904: Incorrect memory ordering in UL
Reviewed-by: rehn, dholmes
1 parent 470c0eb commit 3579024

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/hotspot/share/logging/logOutputList.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ jint LogOutputList::decrease_readers() {
4343

4444
void LogOutputList::wait_until_no_readers() const {
4545
OrderAccess::storeload();
46-
while (_active_readers != 0) {
46+
while (Atomic::load(&_active_readers) != 0) {
4747
// Busy wait
4848
}
49+
// Prevent mutations to the output list to float above the active reader check.
50+
// Such a reordering would lead to readers loading faulty data.
51+
OrderAccess::loadstore();
4952
}
5053

5154
void LogOutputList::set_output_level(LogOutput* output, LogLevelType level) {

0 commit comments

Comments
 (0)