Skip to content

Commit

Permalink
wait() via method
Browse files Browse the repository at this point in the history
  • Loading branch information
jdksjolen committed Feb 11, 2025
1 parent 9a923d6 commit c1c2ee7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/hotspot/share/logging/logAsyncWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ class AsyncLogWriter::AsyncLogLocker : public StackObj {
}

~AsyncLogLocker() {
assert(_holder == Thread::current_or_null(), "must be");
assert(_holder == nullptr || _holder == Thread::current_or_null(), "must be");
_holder = nullptr;
_instance->_lock.unlock();
}

void wait() {
_holder = nullptr;
_instance->_lock.wait(0/* no timeout */);
_holder = Thread::current_or_null();
}
};

Thread* AsyncLogWriter::AsyncLogLocker::_holder = nullptr;
Expand Down Expand Up @@ -205,7 +211,7 @@ void AsyncLogWriter::run() {
AsyncLogLocker locker;

while (!_data_available) {
_lock.wait(0/* no timeout */);
locker.wait();
}
// Only doing a swap and statistics under the lock to
// guarantee that I/O jobs don't block logsites.
Expand Down

0 comments on commit c1c2ee7

Please sign in to comment.