FiberScheduler Class
- Namespace
- SatorImaging.UnityFundamentals
public class FiberScheduler
Provides a mechanism to schedule and manage the execution of tasks with a specified degree of concurrency.
- Inheritance
-
FiberScheduler
- Extension Methods
Remarks
This scheduler is designed to run tasks in a controlled manner, allowing for suspension, resumption, and parallel execution of tasks.
Constructors
- FiberScheduler(int)
Create a new instance of the FiberScheduler class.
Properties
- Default
The default scheduler.
- IsRunning
Gets a value indicating whether the scheduler is currently running.
- Priority
The priority scheduler that temporarily suspends default scheduler and executes tasks.
- RemainingTaskCount
Gets the number of tasks remaining in the queue.
- State
Gets or sets an object that contains data about the scheduler.
- UnsafeRawConcurrencyLevel
Gets a reference to the raw concurrency level field.
> [!IMPORTANT] > Direct modification is not thread-safe. > For thread-safe modifications, use atomic operations or appropriate synchronization mechanisms.
Methods
- AdjustConcurrencyLevel(int)
Adjusts the concurrency level by the specified delta in a thread-safe manner.
- CompleteBatchSubmission()
Completes a batch submission and starts consuming the submitted tasks.
- Resume()
Resumes the execution of a suspended scheduler.
- Submit(Payload, Func<Payload, ValueTask>, bool)
Schedules a new task to be executed by the scheduler.
- Suspend()
Suspends the execution of the scheduler.
Events
- ErrorHandler
Occurs when an error is encountered during task execution.
- OnDidConsume
Occurs after all tasks in the queue have been consumed.
- OnWillConsume
Occurs before the scheduler begins consuming a task.