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

Method blockWithDeadlineFromSampledClock

pkg/sentry/kernel/task_block.go:121–140  ·  view source on GitHub ↗
(C <-chan struct{}, clock ktime.SampledClock, deadline ktime.Time)

Source from the content-addressed store, hash-verified

119}
120
121func (t *Task) blockWithDeadlineFromSampledClock(C <-chan struct{}, clock ktime.SampledClock, deadline ktime.Time) error {
122 // Start the timeout timer.
123 t.blockingTimer.SetClock(clock, ktime.Setting{
124 Enabled: true,
125 Next: deadline,
126 })
127
128 err := t.block(C, t.blockingTimerChan)
129
130 // Stop the timeout timer and drain the channel. If s.Enabled is true, the
131 // timer didn't fire yet, so t.blockingTimerChan must be empty.
132 if _, s := t.blockingTimer.Set(ktime.Setting{}, nil); !s.Enabled {
133 select {
134 case <-t.blockingTimerChan:
135 default:
136 }
137 }
138
139 return err
140}
141
142// Block implements context.Context.Block
143//

Callers 3

BlockWithTimeoutMethod · 0.95
BlockWithDeadlineMethod · 0.95
BlockWithDeadlineFromMethod · 0.95

Calls 3

blockMethod · 0.95
SetClockMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected