@@ -70,7 +70,7 @@ internal async Task<IDisposable> ObtainLockAsync(CancellationToken ct = default)
7070 {
7171 while ( true )
7272 {
73- await _parent . _reentrancy . WaitAsync ( ct ) ;
73+ await _parent . _reentrancy . WaitAsync ( ct ) . ConfigureAwait ( false ) ;
7474 if ( InnerTryEnter ( synchronous : false ) )
7575 {
7676 break ;
@@ -79,7 +79,7 @@ internal async Task<IDisposable> ObtainLockAsync(CancellationToken ct = default)
7979 // We need to "atomically" obtain _retry and release _reentrancy, but there
8080 // is no equivalent to a condition variable. Instead, we call *but don't await*
8181 // _retry.WaitAsync(), then release the reentrancy lock, *then* await the saved task.
82- var waitTask = _parent . _retry . WaitAsync ( ct ) ;
82+ var waitTask = _parent . _retry . WaitAsync ( ct ) . ConfigureAwait ( false ) ;
8383 _parent . _reentrancy . Release ( ) ;
8484 await waitTask ;
8585 }
@@ -115,7 +115,7 @@ internal async Task<IDisposable> ObtainLockAsync(CancellationToken ct = default)
115115 // We need to wait for someone to leave the lock before trying again.
116116 while ( remainder > TimeSpan . Zero )
117117 {
118- await _parent . _reentrancy . WaitAsync ( remainder ) ;
118+ await _parent . _reentrancy . WaitAsync ( remainder ) . ConfigureAwait ( false ) ;
119119 if ( InnerTryEnter ( synchronous : false ) )
120120 {
121121 // Reset the owning thread id after all await calls have finished, otherwise we
@@ -135,7 +135,7 @@ internal async Task<IDisposable> ObtainLockAsync(CancellationToken ct = default)
135135 return null ;
136136 }
137137
138- var waitTask = _parent . _retry . WaitAsync ( remainder ) ;
138+ var waitTask = _parent . _retry . WaitAsync ( remainder ) . ConfigureAwait ( false ) ;
139139 _parent . _reentrancy . Release ( ) ;
140140 if ( ! await waitTask )
141141 {
@@ -156,13 +156,13 @@ internal async Task<IDisposable> ObtainLockAsync(CancellationToken ct = default)
156156 {
157157 while ( true )
158158 {
159- await _parent . _reentrancy . WaitAsync ( cancel ) ;
159+ await _parent . _reentrancy . WaitAsync ( cancel ) . ConfigureAwait ( false ) ;
160160 if ( InnerTryEnter ( synchronous : false ) )
161161 {
162162 break ;
163163 }
164164 // We need to wait for someone to leave the lock before trying again.
165- var waitTask = _parent . _retry . WaitAsync ( cancel ) ;
165+ var waitTask = _parent . _retry . WaitAsync ( cancel ) . ConfigureAwait ( false ) ;
166166 _parent . _reentrancy . Release ( ) ;
167167 await waitTask ;
168168 }
0 commit comments