daly update on 20230502 by nitload youmu
This commit is contained in:
@@ -81,18 +81,29 @@ namespace StgSharp.Logic
|
||||
|
||||
public void Init(int threadCount)
|
||||
{
|
||||
foreach (var item in allNode)
|
||||
if (threadCount!=0)
|
||||
{
|
||||
if (item.Value.IsNative)
|
||||
foreach (var item in allNode)
|
||||
{
|
||||
nativeNodeList.Add(item.Value);
|
||||
if (item.Value.IsNative)
|
||||
{
|
||||
nativeNodeList.Add(item.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeList.Add(item.Value);
|
||||
}
|
||||
}
|
||||
else
|
||||
nativeNodeList.Sort();
|
||||
PrepareTasks(threadCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in allNode)
|
||||
{
|
||||
nodeList.Add(item.Value);
|
||||
}
|
||||
}
|
||||
nativeNodeList.Sort();
|
||||
nodeList.Sort();
|
||||
if (threadCount > nodeList.Count)
|
||||
{
|
||||
@@ -100,29 +111,31 @@ namespace StgSharp.Logic
|
||||
"Thread setting error: amount of threads of this blueprint is larger than amount of nodes.", LogType.Warning);
|
||||
threadCount = nodeList.Count;
|
||||
}
|
||||
for (int i = 0; i < threadCount; i++)
|
||||
}
|
||||
|
||||
public void PrepareTasks(int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
allThread.Add(new Task(
|
||||
|
||||
() =>
|
||||
{
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
RequestNextNode().Run();
|
||||
}
|
||||
}
|
||||
catch (NodeClearException) { }
|
||||
} while (!terminate());
|
||||
}
|
||||
|
||||
));
|
||||
allThread.Add(new Task(IndividualTask));
|
||||
}
|
||||
}
|
||||
|
||||
private void IndividualTask()
|
||||
{
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
RequestNextNode().Run();
|
||||
}
|
||||
}
|
||||
catch (NodeClearException) { }
|
||||
} while (!terminate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run all nodes repeatedly until it is instructed to terminate.
|
||||
/// </summary>
|
||||
@@ -160,11 +173,6 @@ namespace StgSharp.Logic
|
||||
|
||||
private void SingleThreadRun(Func<bool> terminateInstructor)
|
||||
{
|
||||
foreach (var node in nativeNodeList)
|
||||
{
|
||||
nodeList.Add(node);
|
||||
}
|
||||
nodeList.Sort();
|
||||
beginNode.Run();
|
||||
foreach (var item in nodeList)
|
||||
{
|
||||
|
||||
@@ -209,6 +209,7 @@ namespace StgSharp.Logic
|
||||
{
|
||||
try
|
||||
{
|
||||
//Console.WriteLine(name);
|
||||
BlueprintPipeline.WaitAll(inputInterfaces);
|
||||
mainOperation(in inputInterfaces, in outputInterfaces);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Security.Authentication.ExtendedProtection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@@ -68,15 +69,14 @@ namespace StgSharp.Logic
|
||||
|
||||
public void CompleteAndSkip()
|
||||
{
|
||||
Console.WriteLine(Former.Name);
|
||||
Console.WriteLine($"{former.Name}\t->\t{after.Name}\tComplete");
|
||||
//Console.WriteLine($"Complete\t{former.Name}\t->\t{after.Name}");
|
||||
formerCompleteSemaphore.Release();
|
||||
}
|
||||
|
||||
public void CompleteAndWriteData(BlueprintPipelineArgs args)
|
||||
{
|
||||
this.args = args;
|
||||
Console.WriteLine($"{former.Name}\t->\t{after.Name}\tComplete");
|
||||
//Console.WriteLine($"Complete\t{former.Name}\t->\t{after.Name}");
|
||||
formerCompleteSemaphore.Release();
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace StgSharp.Logic
|
||||
|
||||
public void WaitForStart()
|
||||
{
|
||||
Console.WriteLine($"Waiting\t{former.Name}\t->\t{after.Name}");
|
||||
//Console.WriteLine($"Waiting \t{former.Name}\t->\t{after.Name}");
|
||||
formerCompleteSemaphore.Wait();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user