mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-17 01:33:03 +08:00
Fix freezes in _AsyncLock_ (#1549)
This commit is contained in:
@@ -29,7 +29,7 @@ namespace MQTTnet.Benchmarks
|
||||
tasks[i] = Task.Run(
|
||||
async () =>
|
||||
{
|
||||
using (await asyncLock.WaitAsync(CancellationToken.None).ConfigureAwait(false))
|
||||
using (await asyncLock.EnterAsync().ConfigureAwait(false))
|
||||
{
|
||||
var localI = globalI;
|
||||
await Task.Delay(5).ConfigureAwait(false); // Increase the chance for wrong data.
|
||||
@@ -56,7 +56,7 @@ namespace MQTTnet.Benchmarks
|
||||
{
|
||||
for (var i = 0; i < 100000; i++)
|
||||
{
|
||||
using (await asyncLock.WaitAsync(cancellationToken.Token).ConfigureAwait(false))
|
||||
using (await asyncLock.EnterAsync(cancellationToken.Token).ConfigureAwait(false))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user