author | tschatzl |
Tue, 29 May 2018 09:26:00 +0200 | |
changeset 50605 | 7f63c74f0974 |
parent 47216 | 71c04702a3d5 |
child 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
36082
e734f3a55bdf
8136854: G1 ConcurrentG1RefineThread::stop delays JVM shutdown for >150ms
tschatzl
parents:
33123
diff
changeset
|
2 |
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. |
1374 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
21 |
* questions. |
1374 | 22 |
* |
23 |
*/ |
|
24 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_SHARED_CONCURRENTGCTHREAD_HPP |
26 |
#define SHARE_VM_GC_SHARED_CONCURRENTGCTHREAD_HPP |
|
7397 | 27 |
|
30764 | 28 |
#include "runtime/thread.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
9990
diff
changeset
|
29 |
#include "utilities/macros.hpp" |
1374 | 30 |
|
31 |
class ConcurrentGCThread: public NamedThread { |
|
32 |
friend class VMStructs; |
|
33 |
||
36082
e734f3a55bdf
8136854: G1 ConcurrentG1RefineThread::stop delays JVM shutdown for >150ms
tschatzl
parents:
33123
diff
changeset
|
34 |
bool volatile _should_terminate; |
2881 | 35 |
bool _has_terminated; |
1374 | 36 |
|
37 |
// Do initialization steps in the thread: record stack base and size, |
|
38 |
// init thread local storage, set JNI handle block. |
|
39 |
void initialize_in_thread(); |
|
40 |
||
41 |
// Wait until Universe::is_fully_initialized(); |
|
42 |
void wait_for_universe_init(); |
|
43 |
||
44 |
// Record that the current thread is terminating, and will do more |
|
45 |
// concurrent work. |
|
46 |
void terminate(); |
|
47 |
||
37081
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
48 |
protected: |
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
49 |
// Create and start the thread (setting it's priority.) |
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
50 |
void create_and_start(ThreadPriority prio = NearMaxPriority); |
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
51 |
|
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
52 |
// Do the specific GC work. Called by run() after initialization complete. |
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
53 |
virtual void run_service() = 0; |
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
54 |
|
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
55 |
// Shut down the specific GC work. Called by stop() as part of termination protocol. |
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
56 |
virtual void stop_service() = 0; |
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
57 |
|
1374 | 58 |
public: |
59 |
ConcurrentGCThread(); |
|
60 |
||
61 |
// Tester |
|
33123
8a67e36f19d3
8138846: Remove unused enum ConcurrentGCThread::CGC_flag_type
pliden
parents:
30770
diff
changeset
|
62 |
bool is_ConcurrentGC_thread() const { return true; } |
37081
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
63 |
|
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
64 |
virtual void run(); |
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
65 |
|
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
66 |
// shutdown following termination protocol |
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
67 |
virtual void stop(); |
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
68 |
|
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
69 |
bool should_terminate() { return _should_terminate; } |
7656f5356a5d
8140257: Add support for "gc service threads" to ConcurrentGCThread
drwhite
parents:
36082
diff
changeset
|
70 |
bool has_terminated() { return _has_terminated; } |
1374 | 71 |
}; |
72 |
||
30764 | 73 |
#endif // SHARE_VM_GC_SHARED_CONCURRENTGCTHREAD_HPP |