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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user