- All Implemented Interfaces:
- Restorable<ThreadList>, Cloneable, Iterable<ThreadInfo>
public class ThreadList
extends Object
implements Cloneable, Iterable<ThreadInfo>, Restorable<ThreadList>
Contains the list of all ThreadInfos for live java.lang.Thread objects
We add a thread upon creation (within the ThreadInfo ctor), and remove it
when the corresponding java.lang.Thread object gets recycled by JPF. This means
that:
* the thread list can contain terminated threads
* terminated and recycled threads are (eventually) removed from the list
* the list can shrink along a given path
* thread ids don't have to correspond with storing order !!
* thread ids can be re-used
Per default, thread ids are re-used in order to be packed (which is required to efficiently
keep track of referencing threads in ElementInfo reftids). If there is a need
to avoid recycled thread ids, set 'vm.reuse_tid=false'.
NOTE - this ThreadList implementation doubles up as a thread object -> ThreadInfo
map, which is for instance heavily used by the JPF_java_lang_Thread peer.
This implies that ThreadList is still not fully re-organized in case something
keeps terminated thread objects alive. We could avoid this by having a separate
map for live threads<->ThreadInfos, but this would also have to be a backrackable
container that is highly redundant to ThreadList (the only difference being
that terminated threads could be removed from ThreadList).