isUnused method

bool isUnused({
  1. int ownRefs = 0,
})

Whether nothing uses this scope: it holds no resource and no scope or span refers to it. ownRefs references are not counted; the resource manager holds one on each peer scope it keeps.

Implementation

bool isUnused({int ownRefs = 0}) {
  if (_isDone) {
    return true;
  }
  if (_refCnt > ownRefs) {
    return false;
  }
  final s = stat;
  return s.numStreamsInbound == 0 &&
      s.numStreamsOutbound == 0 &&
      s.numConnsInbound == 0 &&
      s.numConnsOutbound == 0 &&
      s.numFD == 0 &&
      s.memory == 0;
}