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()
485
485
return ;
486
486
}
487
487
488
- bool lockTaken = false ;
489
- try
490
- {
491
488
#if NET9_0_OR_GREATER
492
- lockTaken = maintenanceLock . TryEnter ( ) ;
489
+ if ( maintenanceLock . TryEnter ( ) )
493
490
#else
494
- Monitor . TryEnter ( maintenanceLock , ref lockTaken ) ;
491
+ bool lockTaken = false ;
492
+ Monitor . TryEnter ( maintenanceLock , ref lockTaken ) ;
493
+ if ( lockTaken )
495
494
#endif
496
-
497
-
498
- if ( lockTaken )
495
+ {
496
+ try
499
497
{
500
498
int status = this . drainStatus . NonVolatileRead ( ) ;
501
499
@@ -507,16 +505,16 @@ private void TryScheduleDrain()
507
505
this . drainStatus . VolatileWrite ( DrainStatus . ProcessingToIdle ) ;
508
506
scheduler . Run ( this . drainBuffers ) ;
509
507
}
510
- }
511
- finally
512
- {
513
- if ( lockTaken )
514
- {
508
+ finally
509
+ {
515
510
#if NET9_0_OR_GREATER
516
- maintenanceLock . Exit ( ) ;
511
+ maintenanceLock . Exit ( ) ;
517
512
#else
518
- Monitor . Exit ( maintenanceLock ) ;
519
- #endif
513
+ if ( lockTaken )
514
+ {
515
+ Monitor . Exit ( maintenanceLock ) ;
516
+ }
517
+ #endif
520
518
}
521
519
}
522
520
}
You can’t perform that action at this time.
0 commit comments