Class JobSystemThreadPool

All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public class JobSystemThreadPool extends JobSystemWithBarrier
A sample implementation of JobSystem using a pool of worker threads.
  • Constructor Details

    • JobSystemThreadPool

      public JobSystemThreadPool(int maxJobs, int maxBarriers)
      Instantiate a job system with the specified limits.
      Parameters:
      maxJobs - the maximum number of jobs that can be allocated at one time (>1)
      maxBarriers - the maximum number of barriers that can be allocated at one time
      See Also:
    • JobSystemThreadPool

      public JobSystemThreadPool(int maxJobs, int maxBarriers, int numThreads)
      Instantiate a job system with the specified limits.
      Parameters:
      maxJobs - the maximum number of jobs that can be allocated at one time
      maxBarriers - the maximum number of barriers that can be allocated at one time
      numThreads - the number of worker threads to start (≥0) or -1 to autodetect
  • Method Details

    • setNumThreads

      public void setNumThreads(int numThreads)
      Alter the number of worker threads. This is one less than the maximum number of jobs that can execute concurrently.
      Parameters:
      numThreads - the desired number of threads (≥0)