@@ -5,7 +5,7 @@ class Program
5
5
static async Task Main ( )
6
6
{
7
7
await RunUseSemaphoreAsync ( ) ;
8
- await RunUseAsyncSempahoreAsync ( ) ;
8
+ await RunUseAsyncSemaphoreAsync ( ) ;
9
9
Console . ReadLine ( ) ;
10
10
}
11
11
@@ -24,7 +24,7 @@ static async Task Main()
24
24
static async Task RunUseSemaphoreAsync ( )
25
25
{
26
26
Console . WriteLine ( nameof ( RunUseSemaphoreAsync ) ) ;
27
- string [ ] messages = { "one" , "two" , "three" , "four" , "five" , "six" } ;
27
+ string [ ] messages = [ "one" , "two" , "three" , "four" , "five" , "six" ] ;
28
28
Task [ ] tasks = new Task [ messages . Length ] ;
29
29
30
30
for ( int i = 0 ; i < messages . Length ; i ++ )
@@ -41,9 +41,9 @@ static async Task RunUseSemaphoreAsync()
41
41
Console . WriteLine ( ) ;
42
42
}
43
43
44
- static async Task RunUseAsyncSempahoreAsync ( )
44
+ static async Task RunUseAsyncSemaphoreAsync ( )
45
45
{
46
- Console . WriteLine ( nameof ( RunUseAsyncSempahoreAsync ) ) ;
46
+ Console . WriteLine ( nameof ( RunUseAsyncSemaphoreAsync ) ) ;
47
47
string [ ] messages = { "one" , "two" , "three" , "four" , "five" , "six" } ;
48
48
Task [ ] tasks = new Task [ messages . Length ] ;
49
49
@@ -61,7 +61,7 @@ static async Task RunUseAsyncSempahoreAsync()
61
61
Console . WriteLine ( ) ;
62
62
}
63
63
64
- private static SemaphoreSlim s_asyncLock = new SemaphoreSlim ( 1 ) ;
64
+ private static SemaphoreSlim s_asyncLock = new ( 1 ) ;
65
65
static async Task LockWithSemaphore ( string title )
66
66
{
67
67
Console . WriteLine ( $ "{ title } waiting for lock") ;
@@ -78,7 +78,7 @@ static async Task LockWithSemaphore(string title)
78
78
}
79
79
}
80
80
81
- private static AsyncSemaphore s_asyncSemaphore = new AsyncSemaphore ( ) ;
81
+ private static AsyncSemaphore s_asyncSemaphore = new ( ) ;
82
82
static async Task UseAsyncSemaphore ( string title )
83
83
{
84
84
using ( await s_asyncSemaphore . WaitAsync ( ) )
0 commit comments