This queue is responsible for popping and executing jobs
More...
|
int | Push (Job job, bool runImmediatelyIfPossible=false) |
| Place a new job into the appropriate queue, returning the id of the job enqueued More...
|
|
void | PrintSizes () |
| Outputs the size of the side thread and main thread queues
|
|
void | RunMainLoop () |
|
IEnumerator | RunMainLoopYield () |
|
void | Pause () |
| Pause this queue from operating on jobs
|
|
void | Resume () |
| Resume operating on jobs in this queue
|
|
bool | AllThreadsBusy () |
| Reports if the number of jobs started and running exceeds the number of threads This is quite common as jobs will wait for a completion event (they are not blocked though) More...
|
|
void | Clear () |
| Removes all pending jobs from the queue, does NOT abort running jobs
|
|
void | AbortAllJobs () |
| Nukes every job in the queue but keeps the queue running
|
|
void | CancelJobChain (Job job) |
| Removes all dependent children from queue Note: does not remove passed in id, it's implied it's already being worked on and popped from the queue More...
|
|
|
bool | TrackJobs = false |
| Enable this if you want a lot of advanced information about jobs This forces all jobs to print timing and will also scan the job queue periodically to output information
|
|
float | TrackJobsWarnDuration = 5 * 1000 |
| When tracking jobs, when do we complain about a job that's in the queue
|
|
int | maxEventsPerCycle = 32 |
|
|
volatile bool | _isPaused = false |
|
List< Thread > | _threads = new List<Thread>() |
|
List< Job > | _jobs = new List<Job>(100) |
|
List< Job > | _jobsMainThread = new List<Job>(100) |
|
List< Job > | _jobsInc = new List<Job>(100) |
|
List< Job > | _jobsMainThreadInc = new List<Job>(100) |
|
bool | _hasIncJobs = false |
|
Coroutine | mainCoroutine = null |
|
ManualResetEvent | _hasWork = new ManualResetEvent(false) |
|
List< Job > | _jobsRunning = new List<Job>() |
|
Dictionary< int, Job > | _coroutines = new Dictionary<int, Job>() |
|
int | _sleepDuration = 5 |
|
int | _maxShutdownTime = 1000 |
|
float | _maxDurationOnMainThread = 10 |
|
int | _maxJobHistoryDuration = 120 |
|
volatile bool | _isShutdown = false |
|
int | _lastFrameCount = -1 |
|
System.Diagnostics.Stopwatch | _swMainThreadTimer = new System.Diagnostics.Stopwatch() |
|
System.Diagnostics.Stopwatch | _swAdvance = new System.Diagnostics.Stopwatch() |
|
float | _maxCycles = 100f |
|
|
static System.Object | _lockCoroutines = new System.Object() |
|
|
bool | IsPaused [get] |
| Whether the queue is currently paused
|
|
int | Count [get] |
| Gets a non-safe count of the jobs (this will not lock and may not always be accurate) More...
|
|
int | CountMain [get] |
|
int | CountSide [get] |
|
float | MaxDurationOnMainThread [getset] |
| How long in ms that jobs are allowed to run per frame. Default is 10. Set higher when it is more important to process jobs than it is to maintain framerate, such as during loading.
|
|
This queue is responsible for popping and executing jobs
◆ AllThreadsBusy()
bool Astra.JobQueue.AllThreadsBusy |
( |
| ) |
|
|
inline |
Reports if the number of jobs started and running exceeds the number of threads This is quite common as jobs will wait for a completion event (they are not blocked though)
- Returns
◆ CancelJobChain()
void Astra.JobQueue.CancelJobChain |
( |
Job |
job | ) |
|
|
inline |
Removes all dependent children from queue Note: does not remove passed in id, it's implied it's already being worked on and popped from the queue
- Parameters
-
◆ IsJobRunnable()
bool Astra.JobQueue.IsJobRunnable |
( |
Job |
job | ) |
|
|
inlineprotected |
Tells us if a job has all of it's preconditions met and is able to be executed
- Parameters
-
- Returns
- True if we can run it, false if not
◆ IsJobStateRunnable()
bool Astra.JobQueue.IsJobStateRunnable |
( |
Job |
job | ) |
|
|
inlineprotected |
I'm leaving this here for historical reference, this will not work the locks are not stable
- Returns
◆ OnJobInQueuePostFinally()
void Astra.JobQueue.OnJobInQueuePostFinally |
( |
Job |
job | ) |
|
|
inlineprotected |
Fired internally when a job is done
◆ PopB()
Job Astra.JobQueue.PopB |
( |
| ) |
|
|
inlineprotected |
Used internally to get the next job off the queue
- Returns
- The next job or null if no jobs to process
◆ Push()
int Astra.JobQueue.Push |
( |
Job |
job, |
|
|
bool |
runImmediatelyIfPossible = false |
|
) |
| |
|
inline |
Place a new job into the appropriate queue, returning the id of the job enqueued
- Parameters
-
job | Job to be queued |
callback | Optional callback which is called when the job is complete |
◆ RunEnqueuedEvents()
bool Astra.JobQueue.RunEnqueuedEvents |
( |
bool |
mainThread | ) |
|
|
inlineprotected |
Runs pending events based on the queue
- Returns
- True if there are still events, false otherwise
◆ RunOne()
bool Astra.JobQueue.RunOne |
( |
Job |
job = null | ) |
|
|
inlineprotected |
Processes a single job
- Returns
- true if a job was processed, false if none found
◆ _swAdvance
System.Diagnostics.Stopwatch Astra.JobQueue._swAdvance = new System.Diagnostics.Stopwatch() |
|
protected |
Used in editor non-play mode to make coroutines work
◆ Count
Gets a non-safe count of the jobs (this will not lock and may not always be accurate)
The documentation for this class was generated from the following file:
- Assets/Astra/JobSystem/JobQueue.cs