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
--- 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();
}