diff --git a/README.md b/README.md index 99877e9..b375d6a 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,11 @@ AsyncHelper.RunSync(() => SomeFunctionAsync(param1, param2)); // Basic usage for an action running Task or ValueTask var result = AsyncHelper.RunSync(() => SomeFunctionAsync(param1, param2)); + +// Pass in state as a parameter to reduce heap allocations due to closures +AsyncHelper.RunSync(state => SomeFunctionAsync(state, true), param1); +// or you can use a method group if parameters align precisely +AsyncHelper.RunSync(SomeFunctionAsyncWithOneParameter, param1); ``` ## Background @@ -66,8 +71,8 @@ best approach. cd src/CenterEdge.Async.Benchmarks # x64 -dotnet run -c Release -f net5.0 -- job default --runtimes net48 netcoreapp31 netcoreapp50 +dotnet run -c Release -f net8.0 -- job default --runtimes net48 net6.0 net8.0 # x86, .NET 4.8 only -dotnet run -c Release -f net5.0 -- job default --runtimes net48 --platform x86 +dotnet run -c Release -f net8.0 -- job default --runtimes net48 --platform x86 ``` diff --git a/src/CenterEdge.Async/CenterEdge.Async.csproj b/src/CenterEdge.Async/CenterEdge.Async.csproj index 9300579..1fe2e2d 100644 --- a/src/CenterEdge.Async/CenterEdge.Async.csproj +++ b/src/CenterEdge.Async/CenterEdge.Async.csproj @@ -12,11 +12,23 @@ snupkg true key.snk - + Copyright 2023 CenterEdge Software and original post authors at https://social.msdn.microsoft.com/Forums/en-US/163ef755-ff7b-4ea5-b226-bbe8ef5f4796/is-there-a-pattern-for-calling-an-async-method-synchronously?forum=async + CenterEdge Software,Brant Burnett + Assists in the (risky) process of blocking a synchronous method waiting for an asynchronous Task to complete. + async threadpool deadlocks + icon.png + README.md + Apache-2.0 + + + + + + diff --git a/src/CenterEdge.Async/icon.png b/src/CenterEdge.Async/icon.png new file mode 100644 index 0000000..c494fed Binary files /dev/null and b/src/CenterEdge.Async/icon.png differ