8191864: Provide a public destructor for WorkGang
Reviewed-by: stefank, sjohanss
diff --git a/src/hotspot/share/gc/shared/workgroup.cpp b/src/hotspot/share/gc/shared/workgroup.cpp
index 73b3a2a..2538e70 100644
--- a/src/hotspot/share/gc/shared/workgroup.cpp
+++ b/src/hotspot/share/gc/shared/workgroup.cpp
@@ -261,6 +261,10 @@
_dispatcher(create_dispatcher())
{ }
+WorkGang::~WorkGang() {
+ delete _dispatcher;
+}
+
AbstractGangWorker* WorkGang::allocate_worker(uint worker_id) {
return new GangWorker(this, worker_id);
}
diff --git a/src/hotspot/share/gc/shared/workgroup.hpp b/src/hotspot/share/gc/shared/workgroup.hpp
index 320652a..c1b50f3 100644
--- a/src/hotspot/share/gc/shared/workgroup.hpp
+++ b/src/hotspot/share/gc/shared/workgroup.hpp
@@ -122,6 +122,8 @@
// Printing support.
const char* _name;
+ ~AbstractWorkGang() {}
+
private:
// Initialize only instance data.
const bool _are_GC_task_threads;
@@ -206,9 +208,6 @@
// To get access to the GangTaskDispatcher instance.
friend class GangWorker;
- // Never deleted.
- ~WorkGang();
-
GangTaskDispatcher* const _dispatcher;
GangTaskDispatcher* dispatcher() const {
return _dispatcher;
@@ -220,6 +219,8 @@
bool are_GC_task_threads,
bool are_ConcurrentGC_threads);
+ ~WorkGang();
+
// Run a task using the current active number of workers, returns when the task is done.
virtual void run_task(AbstractGangTask* task);
// Run a task with the given number of workers, returns