< prev index next >
src/hotspot/share/services/threadService.hpp
Print this page
rev 52112 : [mq]: 8021335
@@ -56,29 +56,26 @@
static PerfCounter* _total_threads_count;
static PerfVariable* _live_threads_count;
static PerfVariable* _peak_threads_count;
static PerfVariable* _daemon_threads_count;
- // These 2 counters are atomically incremented once the thread is exiting.
- // They will be atomically decremented when ThreadService::remove_thread is called.
- static volatile int _exiting_threads_count;
- static volatile int _exiting_daemon_threads_count;
-
static bool _thread_monitoring_contention_enabled;
static bool _thread_cpu_time_enabled;
static bool _thread_allocated_memory_enabled;
// Need to keep the list of thread dump result that
// keep references to Method* since thread dump can be
// requested by multiple threads concurrently.
static ThreadDumpResult* _threaddump_list;
+ static void decrement_thread_counts(JavaThread* jt, bool daemon);
+
public:
static void init();
static void add_thread(JavaThread* thread, bool daemon);
static void remove_thread(JavaThread* thread, bool daemon);
- static void current_thread_exiting(JavaThread* jt);
+ static void current_thread_exiting(JavaThread* jt, bool daemon);
static bool set_thread_monitoring_contention(bool flag);
static bool is_thread_monitoring_contention() { return _thread_monitoring_contention_enabled; }
static bool set_thread_cpu_time_enabled(bool flag);
@@ -87,15 +84,12 @@
static bool set_thread_allocated_memory_enabled(bool flag);
static bool is_thread_allocated_memory_enabled() { return _thread_cpu_time_enabled; }
static jlong get_total_thread_count() { return _total_threads_count->get_value(); }
static jlong get_peak_thread_count() { return _peak_threads_count->get_value(); }
- static jlong get_live_thread_count() { return _live_threads_count->get_value() - _exiting_threads_count; }
- static jlong get_daemon_thread_count() { return _daemon_threads_count->get_value() - _exiting_daemon_threads_count; }
-
- static int exiting_threads_count() { return _exiting_threads_count; }
- static int exiting_daemon_threads_count() { return _exiting_daemon_threads_count; }
+ static jlong get_live_thread_count() { return _live_threads_count->get_value(); }
+ static jlong get_daemon_thread_count() { return _daemon_threads_count->get_value(); }
// Support for thread dump
static void add_thread_dump(ThreadDumpResult* dump);
static void remove_thread_dump(ThreadDumpResult* dump);
< prev index next >