Package ghidra.trace.model.thread

# Interface TraceThreadManager

All Known Implementing Classes:
  `DBTraceThreadManager`

public interface TraceThreadManager
A store for observed threads over time in a trace

Note that the methods returning collections of threads order them eldest first. "Eldest" means lowest database key, which does not necessarily correlate to earliest creation snap.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TraceThread`
  `addThread(String path, Lifespan lifespan)`
  Add a thread with the given lifespan
  `TraceThread`
  `addThread(String path, String display, Lifespan lifespan)`
  Add a thread with the given lifespan
  `default TraceThread`
  `createThread(String path, long creationSnap)`
  Add a thread with the given creation snap
  `default TraceThread`
  `createThread(String path, String display, long creationSnap)`
  Add a thread with the given creation snap
  `Collection<? extends TraceThread>`
  `getAllThreads()`
  Get all threads ordered eldest first
  `TraceThread`
  `getLiveThreadByPath(long snap, String path)`
  Get the live thread at the given snap by the given path
  `Collection<? extends TraceThread>`
  `getLiveThreads(long snap)`
  Get live threads at the given snap, ordered eldest first
  `TraceThread`
  `getThread(long key)`
  Get the thread with the given key
  `Collection<? extends TraceThread>`
  `getThreadsByPath(String name)`
  Get all threads with the given name, ordered eldest first

- ## Method Details

  - ### addThread

    TraceThread addThread(String path, Lifespan lifespan) throws DuplicateNameException
    Add a thread with the given lifespan
    Parameters:
      `path` - the "full name" of the thread
      `lifespan` - the lifespan of the thread
    Returns:
      the new thread
    Throws:
      `DuplicateNameException` - if a thread with the given full name already exists within an overlapping snap

  - ### addThread

    TraceThread addThread(String path, String display, Lifespan lifespan) throws DuplicateNameException
    Add a thread with the given lifespan
    Parameters:
      `path` - the "full name" of the thread
      `display` - "short name" of the thread
      `lifespan` - the lifespan of the thread
    Returns:
      the new thread
    Throws:
      `DuplicateNameException` - if a thread with the given full name already exists within an overlapping snap

  - ### createThread

    default TraceThread createThread(String path, long creationSnap) throws DuplicateNameException
    Add a thread with the given creation snap
    Throws:
      `DuplicateNameException`
    See Also:
      - `addThread(String, Lifespan)`

  - ### createThread

    default TraceThread createThread(String path, String display, long creationSnap) throws DuplicateNameException
    Add a thread with the given creation snap
    Throws:
      `DuplicateNameException`
    See Also:
      - `addThread(String, String, Lifespan)`

  - ### getAllThreads

    Collection<? extends TraceThread> getAllThreads()
    Get all threads ordered eldest first
    Returns:
      the collection

  - ### getThreadsByPath

    Collection<? extends TraceThread> getThreadsByPath(String name)
    Get all threads with the given name, ordered eldest first
    Parameters:
      `name` - the name
    Returns:
      the collection

  - ### getLiveThreadByPath

    TraceThread getLiveThreadByPath(long snap, String path)
    Get the live thread at the given snap by the given path
    Parameters:
      `snap` - the snap which the thread's lifespan must contain
      `path` - the path of the thread
    Returns:
      the thread, or `null` if no thread matches

  - ### getThread

    TraceThread getThread(long key)
    Get the thread with the given key
    Parameters:
      `key` - the database key
    Returns:
      the thread

  - ### getLiveThreads

    Collection<? extends TraceThread> getLiveThreads(long snap)
    Get live threads at the given snap, ordered eldest first

    Note that thread whose destruction was observed at the given snap are not considered alive, i.e, the upper end of the lifespan is treated as open.

    Parameters:
      `snap` - the snap
    Returns:
      the collection