Cleanup of no longer needed classes. ParallelSynchronizationContext/-Pool renamed to IndexOfSynchronizationContext/-Pool.
This commit is contained in:
1 parent
9ece531129
commit
24c2491df0
9 files changed
+80
-255
No files matched your search
@@ -0,0 +1,43 @@
|
||||
namespace Recyclable.Collections.Parallel
|
||||
{
|
||||
public sealed class IndexOfSynchronizationContext : IDisposable
|
||||
{
|
||||
internal bool _isItemFound;
|
||||
|
||||
public readonly Barrier AllDoneSignal;
|
||||
public long FoundItemIndex;
|
||||
public Exception? Exception;
|
||||
internal bool _returned;
|
||||
|
||||
public IndexOfSynchronizationContext()
|
||||
{
|
||||
AllDoneSignal = new(0);
|
||||
}
|
||||
|
||||
public IndexOfSynchronizationContext(int participantCount)
|
||||
{
|
||||
AllDoneSignal = new(participantCount);
|
||||
}
|
||||
|
||||
public void SetItemFound()
|
||||
{
|
||||
_isItemFound = true;
|
||||
}
|
||||
|
||||
public bool IsItemFound => _isItemFound;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_returned)
|
||||
{
|
||||
_returned = true;
|
||||
IndexOfSynchronizationContextPool.Shared.Return(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
AllDoneSignal.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user