MCPcopy
hub / github.com/google/gvisor / Isolate

Method Isolate

pkg/segment/set.go:924–932  ·  view source on GitHub ↗

Isolate ensures that the given segment's range is a subset of r by splitting at r.Start and r.End if necessary, and returns an updated iterator to the bounded segment. All existing iterators (including seg, but not including the returned iterators) are invalidated. Isolate is usually used when muta

(seg Iterator, r Range)

Source from the content-addressed store, hash-verified

922//
923// Preconditions: seg.Range().Overlaps(r).
924func (s *Set) Isolate(seg Iterator, r Range) Iterator {
925 if seg.Range().CanSplitAt(r.Start) {
926 _, seg = s.SplitUnchecked(seg, r.Start)
927 }
928 if seg.Range().CanSplitAt(r.End) {
929 seg, _ = s.SplitUnchecked(seg, r.End)
930 }
931 return seg
932}
933
934// LowerBoundSegmentSplitBefore combines LowerBoundSegment and SplitBefore.
935//

Callers 15

RemoveRangeWithMethod · 0.95
TestIsolateFunction · 0.95
unlockMethod · 0.80
SaveToMethod · 0.80
updateUsageLockedMethod · 0.80
ForkMethod · 0.80
MRemapMethod · 0.80
MProtectMethod · 0.80
MLockMethod · 0.80
SetNumaPolicyMethod · 0.80
DecommitMethod · 0.80
getPMAsInternalLockedMethod · 0.80

Calls 3

SplitUncheckedMethod · 0.95
CanSplitAtMethod · 0.80
RangeMethod · 0.45

Tested by 1

TestIsolateFunction · 0.76