Skip to content
This repository was archived by the owner on Apr 10, 2018. It is now read-only.

Commit 5179ad2

Browse files
committed
TestGuardLock1 should (finally) work...
1 parent 4658793 commit 5179ad2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

RestSharp.Portable.Test/GuardTests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ public class GuardTests
1212
[Fact]
1313
public void TestGuardLock1()
1414
{
15+
var taskStartMutex = new AutoResetEvent(false);
1516
var guard = new AsyncLock();
1617
var results = new ConcurrentQueue<int>();
1718
var t1 = Task.Run(
1819
async () =>
1920
{
2021
using (await guard.LockAsync(CancellationToken.None))
22+
{
23+
taskStartMutex.Set();
2124
Thread.Sleep(TimeSpan.FromMilliseconds(500));
25+
}
2226
results.Enqueue(1);
2327
});
28+
taskStartMutex.WaitOne();
2429
Thread.Sleep(TimeSpan.FromMilliseconds(100));
2530
var t2 = Task.Run(
2631
async () =>

0 commit comments

Comments
 (0)