From 3936052d73a3af4ed04156a470407915834a4fd6 Mon Sep 17 00:00:00 2001 From: Stefan Ring Date: Tue, 19 Apr 2011 13:52:12 +0200 Subject: [PATCH] * src/threads/threadlist.cpp: Fixed strategy for giving out thread indexes. * src/threads/threadlist.hpp (_last_index): Added. --- src/threads/threadlist.cpp | 4 +++- src/threads/threadlist.hpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/threads/threadlist.cpp b/src/threads/threadlist.cpp index 0350a1620..a24ba4441 100644 --- a/src/threads/threadlist.cpp +++ b/src/threads/threadlist.cpp @@ -52,6 +52,8 @@ int32_t ThreadList::_number_of_active_java_threads; int32_t ThreadList::_peak_of_active_java_threads; int32_t ThreadList::_number_of_non_daemon_threads; +int32_t ThreadList::_last_index = 0; + /** * Dumps info for all threads running in the VM. This function is @@ -192,7 +194,7 @@ int32_t ThreadList::get_free_thread_index() } else { // Get a new the thread index. - index = _active_thread_list.size() + 1; + index = ++_last_index; } unlock(); diff --git a/src/threads/threadlist.hpp b/src/threads/threadlist.hpp index 4ca60a85d..b856c3ba7 100644 --- a/src/threads/threadlist.hpp +++ b/src/threads/threadlist.hpp @@ -57,6 +57,8 @@ private: // Thread counters for internal usage. static int32_t _number_of_non_daemon_threads; + static int32_t _last_index; + static void remove_from_active_thread_list(threadobject* t); static void add_to_free_thread_list(threadobject* t); static void add_to_free_index_list(int32_t index); -- 2.25.1