File tree Expand file tree Collapse file tree
src/Microsoft.VisualStudio.Threading
test/Microsoft.VisualStudio.Threading.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ public AsyncCrossProcessMutex(string name)
5656 Requires . NotNullOrEmpty ( name ) ;
5757 this . namedMutexOwner = new Thread ( this . MutexOwnerThread , 256 * 1024 )
5858 {
59+ IsBackground = true ,
5960 Name = $ "{ nameof ( AsyncCrossProcessMutex ) } -{ name } ",
6061 } ;
6162 this . mutex = new Mutex ( false , name ) ;
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ public async Task TryEnterAsync_Reentrancy()
7272 public async Task EnterAsync_Contested ( )
7373 {
7474 // We don't allow attempted reentrancy, so create a new mutex object to use for the contested locks.
75- AsyncCrossProcessMutex mutex2 = new ( this . mutex . Name ) ;
75+ using AsyncCrossProcessMutex mutex2 = new ( this . mutex . Name ) ;
7676
7777 // Acquire and hold the mutex so that we can test timeout behavior.
7878 using ( AsyncCrossProcessMutex . LockReleaser releaser = await this . mutex . EnterAsync ( ) )
@@ -95,7 +95,7 @@ public async Task EnterAsync_Contested()
9595 public async Task TryEnterAsync_Contested ( )
9696 {
9797 // We don't allow attempted reentrancy, so create a new mutex object to use for the contested locks.
98- AsyncCrossProcessMutex mutex2 = new ( this . mutex . Name ) ;
98+ using AsyncCrossProcessMutex mutex2 = new ( this . mutex . Name ) ;
9999
100100 // Acquire and hold the mutex so that we can test timeout behavior.
101101 using ( AsyncCrossProcessMutex . LockReleaser ? releaser = await this . mutex . TryEnterAsync ( Timeout . InfiniteTimeSpan ) )
You can’t perform that action at this time.
0 commit comments