Skip to content

Commit

Permalink
refactored StructuredAsyncLock
Browse files Browse the repository at this point in the history
  • Loading branch information
Timon committed Oct 10, 2023
1 parent a48afb0 commit 6006919
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 22 deletions.
13 changes: 0 additions & 13 deletions MemoizR.AsyncLock/MemoizR.AsyncLock.csproj

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MemoizR.AsyncLock;
namespace MemoizR.StructuredAsyncLock;

public class AsyncAsymmetricLock
{
Expand Down
32 changes: 32 additions & 0 deletions MemoizR.StructuredAsyncLock/MemoizR.StructuredAsyncLock.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<PackageId>MemoizR.StructuredAsyncLock</PackageId>
<Version>0.0.5</Version>
<Authors>Timon Krebs</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageReadmeFile>NUGET_ASYNC_LOCK_README.md</PackageReadmeFile>
<PackageIcon>MemoizR-Small.png</PackageIcon>
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>

<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageTags>Memoization, StructuredConcurrency, Structured Concurrency, Graph, Dependency, Dependencies, Dynamic, Dynamic Dependencies, Concurrency, Lazy, Resolve, Perf, Performance, Parallel, Parallel Computing, Sync, Synchronization, State, State Synchronization</PackageTags>
</PropertyGroup>
<ItemGroup>
<None Include="..\docs\NUGET_ASYNC_LOCK_README.md" Pack="true" PackagePath="\" />
<None Include="..\docs\MemoizR-Small.png" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Nito.Collections.Deque" Version="1.1.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Diagnostics;
using Nito.Collections;

namespace MemoizR.AsyncLock;
namespace MemoizR.StructuredAsyncLock;

/// <summary>
/// A collection of cancelable <see cref="TaskCompletionSource{T}"/> instances. Implementations must assume the caller is holding a lock.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Runtime.CompilerServices;

namespace MemoizR.AsyncLock;
namespace MemoizR.StructuredAsyncLock;

/// <summary>
/// An awaitable wrapper around a task whose result is disposable. The wrapper is not disposable, so this prevents usage errors like "using (MyAsync())" when the appropriate usage should be "using (await MyAsync())".
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MemoizR.AsyncLock;
namespace MemoizR.StructuredAsyncLock;

/// <summary>
/// Provides extension methods for <see cref="TaskCompletionSource{TResult}"/>.
Expand Down
2 changes: 1 addition & 1 deletion MemoizR.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MemoizR.Reactive", "MemoizR
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MemoizR.StructuredConcurrency", "MemoizR.StructuredConcurrency\MemoizR.StructuredConcurrency.csproj", "{565C60BC-380D-4E30-B621-A31C5E229A7F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MemoizR.AsyncLock", "MemoizR.AsyncLock\MemoizR.AsyncLock.csproj", "{412EE767-E418-4103-B4B1-4D61A2D91D13}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MemoizR.StructuredAsyncLock", "MemoizR.StructuredAsyncLock\MemoizR.StructuredAsyncLock.csproj", "{412EE767-E418-4103-B4B1-4D61A2D91D13}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion MemoizR/Context.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MemoizR.AsyncLock;
using MemoizR.StructuredAsyncLock;

namespace MemoizR;

Expand Down
2 changes: 1 addition & 1 deletion MemoizR/MemoizR.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\MemoizR.AsyncLock\MemoizR.AsyncLock.csproj" />
<ProjectReference Include="..\MemoizR.StructuredAsyncLock\MemoizR.StructuredAsyncLock.csproj" />
</ItemGroup>

<PropertyGroup>
Expand Down
2 changes: 0 additions & 2 deletions MemoizR/Signal.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using MemoizR.AsyncLock;

namespace MemoizR;

public sealed class Signal<T> : MemoHandlR<T>
Expand Down
6 changes: 6 additions & 0 deletions docs/NUGET_ASYNC_LOCK_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# MemoizR:AsyncLock

AsyncAsymmetricLock should only be used in accordance with structured sequential concurrency.
No Task should be stored in a variable to ensure structured sequential concurrency.

Otherwise it there will be undefined behaviour.

0 comments on commit 6006919

Please sign in to comment.