File tree Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -485,17 +485,15 @@ private void TryScheduleDrain()
485485 return ;
486486 }
487487
488- bool lockTaken = false ;
489- try
490- {
491488#if NET9_0_OR_GREATER
492- lockTaken = maintenanceLock . TryEnter ( ) ;
489+ if ( maintenanceLock . TryEnter ( ) )
493490#else
494- Monitor . TryEnter ( maintenanceLock , ref lockTaken ) ;
491+ bool lockTaken = false ;
492+ Monitor . TryEnter ( maintenanceLock , ref lockTaken ) ;
493+ if ( lockTaken )
495494#endif
496-
497-
498- if ( lockTaken )
495+ {
496+ try
499497 {
500498 int status = this . drainStatus . NonVolatileRead ( ) ;
501499
@@ -507,16 +505,16 @@ private void TryScheduleDrain()
507505 this . drainStatus . VolatileWrite ( DrainStatus . ProcessingToIdle ) ;
508506 scheduler . Run ( this . drainBuffers ) ;
509507 }
510- }
511- finally
512- {
513- if ( lockTaken )
514- {
508+ finally
509+ {
515510#if NET9_0_OR_GREATER
516- maintenanceLock . Exit ( ) ;
511+ maintenanceLock . Exit ( ) ;
517512#else
518- Monitor . Exit ( maintenanceLock ) ;
519- #endif
513+ if ( lockTaken )
514+ {
515+ Monitor . Exit ( maintenanceLock ) ;
516+ }
517+ #endif
520518 }
521519 }
522520 }
You can’t perform that action at this time.
0 commit comments