2008-06-05 15:57:56 -07:00
|
|
|
/*
|
2016-02-10 12:08:37 +01:00
|
|
|
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
|
2008-06-05 15:57:56 -07:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2008-06-05 15:57:56 -07:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-05-13 15:16:06 +02:00
|
|
|
#ifndef SHARE_VM_GC_SHARED_CONCURRENTGCTHREAD_HPP
|
|
|
|
#define SHARE_VM_GC_SHARED_CONCURRENTGCTHREAD_HPP
|
2010-11-23 13:22:55 -08:00
|
|
|
|
|
|
|
#include "runtime/thread.hpp"
|
2015-05-13 15:16:06 +02:00
|
|
|
#include "utilities/macros.hpp"
|
2008-06-05 15:57:56 -07:00
|
|
|
|
|
|
|
class ConcurrentGCThread: public NamedThread {
|
|
|
|
friend class VMStructs;
|
|
|
|
|
2016-02-10 12:08:37 +01:00
|
|
|
bool volatile _should_terminate;
|
2009-05-11 16:30:56 -07:00
|
|
|
bool _has_terminated;
|
2008-06-05 15:57:56 -07:00
|
|
|
|
|
|
|
// Do initialization steps in the thread: record stack base and size,
|
|
|
|
// init thread local storage, set JNI handle block.
|
|
|
|
void initialize_in_thread();
|
|
|
|
|
|
|
|
// Wait until Universe::is_fully_initialized();
|
|
|
|
void wait_for_universe_init();
|
|
|
|
|
|
|
|
// Record that the current thread is terminating, and will do more
|
|
|
|
// concurrent work.
|
|
|
|
void terminate();
|
|
|
|
|
2016-03-11 16:59:58 -05:00
|
|
|
protected:
|
|
|
|
// Create and start the thread (setting it's priority.)
|
|
|
|
void create_and_start(ThreadPriority prio = NearMaxPriority);
|
|
|
|
|
|
|
|
// Do the specific GC work. Called by run() after initialization complete.
|
|
|
|
virtual void run_service() = 0;
|
|
|
|
|
|
|
|
// Shut down the specific GC work. Called by stop() as part of termination protocol.
|
|
|
|
virtual void stop_service() = 0;
|
|
|
|
|
2008-06-05 15:57:56 -07:00
|
|
|
public:
|
|
|
|
ConcurrentGCThread();
|
|
|
|
|
|
|
|
// Tester
|
2015-10-06 08:05:11 +02:00
|
|
|
bool is_ConcurrentGC_thread() const { return true; }
|
2016-03-11 16:59:58 -05:00
|
|
|
|
|
|
|
virtual void run();
|
|
|
|
|
|
|
|
// shutdown following termination protocol
|
|
|
|
virtual void stop();
|
|
|
|
|
|
|
|
bool should_terminate() { return _should_terminate; }
|
|
|
|
bool has_terminated() { return _has_terminated; }
|
2008-06-05 15:57:56 -07:00
|
|
|
};
|
|
|
|
|
2015-05-13 15:16:06 +02:00
|
|
|
#endif // SHARE_VM_GC_SHARED_CONCURRENTGCTHREAD_HPP
|