8191864: Provide a public destructor for WorkGang
authorpliden
Mon, 27 Nov 2017 13:50:03 +0100
changeset 48123 f93055f440d8
parent 48122 37937ce6adf3
child 48124 f140bebf0348
8191864: Provide a public destructor for WorkGang Reviewed-by: stefank, sjohanss
src/hotspot/share/gc/shared/workgroup.cpp
src/hotspot/share/gc/shared/workgroup.hpp
--- a/src/hotspot/share/gc/shared/workgroup.cpp	Mon Nov 27 13:34:00 2017 +0100
+++ b/src/hotspot/share/gc/shared/workgroup.cpp	Mon Nov 27 13:50:03 2017 +0100
@@ -261,6 +261,10 @@
     _dispatcher(create_dispatcher())
 { }
 
+WorkGang::~WorkGang() {
+  delete _dispatcher;
+}
+
 AbstractGangWorker* WorkGang::allocate_worker(uint worker_id) {
   return new GangWorker(this, worker_id);
 }
--- a/src/hotspot/share/gc/shared/workgroup.hpp	Mon Nov 27 13:34:00 2017 +0100
+++ b/src/hotspot/share/gc/shared/workgroup.hpp	Mon Nov 27 13:50:03 2017 +0100
@@ -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