* src/threads/threadlist.cpp: Fixed strategy for giving out thread indexes.
authorStefan Ring <stefan@complang.tuwien.ac.at>
Tue, 19 Apr 2011 11:52:12 +0000 (13:52 +0200)
committerStefan Ring <stefan@complang.tuwien.ac.at>
Tue, 19 Apr 2011 11:52:12 +0000 (13:52 +0200)
* src/threads/threadlist.hpp (_last_index): Added.

src/threads/threadlist.cpp
src/threads/threadlist.hpp

index 0350a1620b150f24aabcda1ca07462c671cc7bb3..a24ba44412c1053f844922ab59eeee38f0ca9e03 100644 (file)
@@ -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();
index 4ca60a85dea0f13c5780d854c2ec4a3e29ec1e3f..b856c3ba769f54b5f0ef102043f109da52862352 100644 (file)
@@ -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);