mat
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.Collections;
|
||||
using StgSharp.HighPerformance.Memory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
@@ -59,25 +60,16 @@ namespace StgSharp.Mathematics.Numeric
|
||||
)
|
||||
{
|
||||
_threads = threadArray;
|
||||
IsMultithread = threadArray.Length > 1;
|
||||
_countdownEvent = new CountdownEvent(threadArray.Length);
|
||||
}
|
||||
|
||||
public ReadOnlySpan<MatrixParallelThread> Threads
|
||||
{
|
||||
get
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, nameof(MatrixParallelWrap));
|
||||
|
||||
return _threads;
|
||||
}
|
||||
}
|
||||
public ReadOnlySpan<MatrixParallelThread> Threads => _disposed ? [] : _threads;
|
||||
|
||||
public ThreadPriority AfterWork { get; private set; }
|
||||
|
||||
internal MatrixParallelQueue TaskQueue { get; set; }
|
||||
internal L4 DataCache { get; set; }
|
||||
|
||||
private bool IsMultithread { get; init; }
|
||||
internal MatrixParallelQueue TaskQueue { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
@@ -90,6 +82,7 @@ namespace StgSharp.Mathematics.Numeric
|
||||
SleepMode afterWork
|
||||
)
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, nameof(MatrixParallelWrap));
|
||||
AfterWork = (ThreadPriority)afterWork;
|
||||
foreach (MatrixParallelThread thread in _threads)
|
||||
{
|
||||
@@ -101,7 +94,9 @@ namespace StgSharp.Mathematics.Numeric
|
||||
|
||||
public void WaitAllWraps()
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, nameof(MatrixParallelWrap));
|
||||
if (_disposed) {
|
||||
return;
|
||||
}
|
||||
_countdownEvent.Wait();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user