close method
Closes all underlying file handles in the pool.
Implementation
Future<void> close() async {
if (_isClosed) return;
_isClosed = true;
for (final waiter in _waiters) {
if (!waiter.isCompleted) {
waiter.completeError(StateError('SvsFile was closed'));
}
}
_waiters.clear();
for (final waiter in _rafWaiters) {
if (!waiter.isCompleted) {
waiter.completeError(StateError('SvsFile was closed'));
}
}
_rafWaiters.clear();
final handlesToClose = List<RandomAccessFile>.from(_allHandles);
_allHandles.clear();
_availableHandles.clear();
_busyHandles.clear();
for (final handle in handlesToClose) {
try {
await handle.close();
} catch (_) {}
}
}