8230611: infinite loop in LogOutputList::wait_until_no_readers()
authordbuck
Thu, 21 Nov 2019 23:32:11 -0500
changeset 59215 fcd74557a9cc
parent 59214 e7df7c86eda1
child 59216 47c879f478d2
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
src/hotspot/share/logging/logOutputList.hpp
--- 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();
     }