changeset 57052:fcd74557a9cc

8230611: infinite loop in LogOutputList::wait_until_no_readers() Summary: Add copy constructor and copy assignment operator to ensure reader count remains accurate Reviewed-by: kbarrett, dholmes
author dbuck
date Thu, 21 Nov 2019 23:32:11 -0500
parents e7df7c86eda1
children 47c879f478d2
files src/hotspot/share/logging/logOutputList.hpp
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/logging/logOutputList.hpp	Thu Nov 21 18:42:33 2019 -0800
+++ b/src/hotspot/share/logging/logOutputList.hpp	Thu Nov 21 23:32:11 2019 -0500
@@ -97,6 +97,20 @@
     }
 
    public:
+    Iterator(const Iterator &itr) : _current(itr._current), _list(itr._list){
+      itr._list->increase_readers();
+    }
+
+    Iterator& operator=(const Iterator& rhs) {
+      _current = rhs._current;
+      if (_list != rhs._list) {
+        rhs._list->increase_readers();
+        _list->decrease_readers();
+        _list = rhs._list;
+      }
+      return *this;
+    }
+
     ~Iterator() {
       _list->decrease_readers();
     }