Issue
The Rotate() method acquires _lock around CloseWriter():
private void Rotate()
{
// ...
lock (_lock)
{
CloseWriter();
}
}
However, Rotate() is only called from CheckRotation(), which is called from WriteLine() and Write() — both of which already hold _lock. C#'s Monitor is reentrant so this doesn't deadlock, but the redundant lock is misleading and suggests the locking strategy isn't well-defined.
Suggested fix
Remove the inner lock (_lock) in Rotate() and add a comment that the caller must hold the lock.
File
src/Servy.Core/IO/RotatingStreamWriter.cs — lines 326-334
Issue
The
Rotate()method acquires_lockaroundCloseWriter():However,
Rotate()is only called fromCheckRotation(), which is called fromWriteLine()andWrite()— both of which already hold_lock. C#'sMonitoris reentrant so this doesn't deadlock, but the redundant lock is misleading and suggests the locking strategy isn't well-defined.Suggested fix
Remove the inner
lock (_lock)inRotate()and add a comment that the caller must hold the lock.File
src/Servy.Core/IO/RotatingStreamWriter.cs— lines 326-334