mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 04:13:40 +01:00
supply Channel<T> create params
This commit is contained in:
parent
e2ed5258eb
commit
c9f613931f
1 changed files with 5 additions and 2 deletions
|
|
@ -16,8 +16,8 @@ internal class TextureLoadThrottler : IServiceType, IDisposable
|
||||||
private readonly Task adderTask;
|
private readonly Task adderTask;
|
||||||
private readonly Task[] workerTasks;
|
private readonly Task[] workerTasks;
|
||||||
|
|
||||||
private readonly Channel<WorkItem> newItemChannel = Channel.CreateUnbounded<WorkItem>();
|
private readonly Channel<WorkItem> newItemChannel;
|
||||||
private readonly Channel<object?> workTokenChannel = Channel.CreateUnbounded<object?>();
|
private readonly Channel<object?> workTokenChannel;
|
||||||
private readonly List<WorkItem> workItemPending = new();
|
private readonly List<WorkItem> workItemPending = new();
|
||||||
|
|
||||||
private bool disposing;
|
private bool disposing;
|
||||||
|
|
@ -25,6 +25,9 @@ internal class TextureLoadThrottler : IServiceType, IDisposable
|
||||||
[ServiceManager.ServiceConstructor]
|
[ServiceManager.ServiceConstructor]
|
||||||
private TextureLoadThrottler()
|
private TextureLoadThrottler()
|
||||||
{
|
{
|
||||||
|
this.newItemChannel = Channel.CreateUnbounded<WorkItem>(new() { SingleReader = true });
|
||||||
|
this.workTokenChannel = Channel.CreateUnbounded<object?>(new() { SingleWriter = true });
|
||||||
|
|
||||||
this.adderTask = Task.Run(this.LoopAddWorkItemAsync);
|
this.adderTask = Task.Run(this.LoopAddWorkItemAsync);
|
||||||
this.workerTasks = new Task[Math.Max(1, Environment.ProcessorCount - 1)];
|
this.workerTasks = new Task[Math.Max(1, Environment.ProcessorCount - 1)];
|
||||||
foreach (ref var task in this.workerTasks.AsSpan())
|
foreach (ref var task in this.workerTasks.AsSpan())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue