SnackSimThreadPool - Angel-125/Snacks GitHub Wiki
This class handles simulator thread creation, data synching, and the job list.s
Fields
maxThreads
Max number of threads allowed
jobList
List of simulator jobs waiting to be run
Methods
OnThreadSimulationComplete(Snacks.SimSnacks)
Handles the completion of a thread's simulation.
Parameters
simulator: The simulator that just finished.
OnThreadSimulatorCycleComplete(Snacks.SimSnacks)
Handles completion of a thread's simulation cycle.
Parameters
simulator: The simulator that just completed its cycle.
OnSimulatorException(Snacks.SimSnacks,System.Exception)
Handles the exception generated by a simulator.
Parameters
simulator: The simulator that generated the exception.
ex: The Exception generated.
LockResourceDurations
Locks the vessel resource durations so that we can query them. Be sure to call UnlockResourceDurations when done.
UnlockResourceDurations
Unlocks resource durations so that threads can operate on them.
GetVesselResourceDurations(Vessel)
Returns the vessel resource definitions for the requested vessel. Be sure to call LockResourceDurations before calling this method. Be sure to call UnlockResourceDurations after you're done.
Parameters
vessel: The vessel to query
Return value
The resource durations for the specified vessel, or null if they don't exist.
ConvertersAssumedActive(Vessel)
Determines whether or not the simulator had to assume that converters were on.
Parameters
vessel: The vessel to query
Return value
true if the simulator couldn't determine activation state and had to assume converters were on; false if not.
RemoveVesselResourceDurations(Vessel)
Removes the vessel resource durations for the specified vessel if they exist. Be sure to call LockResourceDurations before calling this method. Be sure to call UnlockResourceDurations after you're done.
Parameters
vessel: The vessel that will no longer have resource durations.
AddSimulatorJob(Snacks.SimSnacks)
Adds a simulator to the job list.
Parameters
simulator: The SimSnacks simulator to add to the list.
StopAllJobs
Stops all current and pending jobs.