find a way to create Thread binded to LogicalCore properly
This commit is contained in:
@@ -59,6 +59,25 @@ namespace StgSharp.Common.HighPerformance.ProcessorAbstraction
|
||||
return NumaAllocNative(size, numaId);
|
||||
}
|
||||
|
||||
public static T[][] CreateForeachThread<T>(
|
||||
Func<LogicalCore, T> factory
|
||||
)
|
||||
{
|
||||
if (factory is null) {
|
||||
return [];
|
||||
}
|
||||
T[][] arr = new T[_numaNodes.Length][];
|
||||
foreach (NumaNode node in _numaNodes)
|
||||
{
|
||||
T[] values = new T[node.LogicalCoreCount];
|
||||
ReadOnlySpan<LogicalCore> cores = node.LogicalCores;
|
||||
for (int i = 0; i < cores.Length; i++) {
|
||||
values[i] = factory(cores[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public static unsafe void Free(
|
||||
void* address,
|
||||
int numaId,
|
||||
|
||||
Reference in New Issue
Block a user