Package com.github.stephengold.joltjni
Class JobSystemThreadPool
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.JobSystem
com.github.stephengold.joltjni.JobSystemWithBarrier
com.github.stephengold.joltjni.JobSystemThreadPool
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
A sample implementation of
JobSystem
using a pool of worker threads.-
Constructor Summary
ConstructorsConstructorDescriptionJobSystemThreadPool
(int maxJobs, int maxBarriers) Instantiate a job system with the specified limits.JobSystemThreadPool
(int maxJobs, int maxBarriers, int numThreads) Instantiate a job system with the specified limits. -
Method Summary
Modifier and TypeMethodDescriptionvoid
setNumThreads
(int numThreads) Alter the number of worker threads.Methods inherited from class com.github.stephengold.joltjni.JobSystem
getMaxConcurrency
Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
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 timemaxBarriers
- the maximum number of barriers that can be allocated at one timenumThreads
- 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)
-