Skip to content

Commit c581598

Browse files
committed
8273381: Assert in PtrQueueBufferAllocatorTest.stress_free_list_allocator_vm
Backport-of: c80a612709f1e483575e2843c1f0ea84e1b9a257
1 parent cb769c0 commit c581598

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/hotspot/gtest/gc/shared/test_ptrQueueBufferAllocator.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,18 @@ class BufferNode::TestSupport::ProcessorThread : public JavaTestThread {
180180
{}
181181

182182
virtual void main_run() {
183+
bool shutdown_requested = false;
183184
while (true) {
184185
BufferNode* node = _cbl->pop();
185186
if (node != NULL) {
186187
_allocator->release(node);
187-
} else if (!Atomic::load_acquire(_continue_running)) {
188+
} else if (shutdown_requested) {
188189
return;
190+
} else if (!Atomic::load_acquire(_continue_running)) {
191+
// To avoid a race that could leave buffers in the list after this
192+
// thread has shut down, continue processing until the list is empty
193+
// *after* the shut down request has been received.
194+
shutdown_requested = true;
189195
}
190196
ThreadBlockInVM tbiv(this); // Safepoint check.
191197
}

0 commit comments

Comments
 (0)