summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/task_block.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-12-07 01:04:20 +0000
committergVisor bot <gvisor-bot@google.com>2019-12-07 01:04:20 +0000
commit5648c029a4358d4c2803fba978a3d86cae894766 (patch)
treea0a94433bbc41f3115568149160976c5bd459d89 /pkg/sentry/kernel/task_block.go
parente880bc78798d9abe8554f82dc2106e6fd85ffc5e (diff)
parent371e210b83c244d8828ad2fa1b3d7cef15fbf463 (diff)
Merge release-20191129.0-18-g371e210 (automated)
Diffstat (limited to 'pkg/sentry/kernel/task_block.go')
-rw-r--r--pkg/sentry/kernel/task_block.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/sentry/kernel/task_block.go b/pkg/sentry/kernel/task_block.go
index dd69939f9..4a4a69ee2 100644
--- a/pkg/sentry/kernel/task_block.go
+++ b/pkg/sentry/kernel/task_block.go
@@ -16,6 +16,7 @@ package kernel
import (
"runtime"
+ "runtime/trace"
"time"
ktime "gvisor.dev/gvisor/pkg/sentry/kernel/time"
@@ -133,19 +134,24 @@ func (t *Task) block(C <-chan struct{}, timerChan <-chan struct{}) error {
runtime.Gosched()
}
+ region := trace.StartRegion(t.traceContext, blockRegion)
select {
case <-C:
+ region.End()
t.SleepFinish(true)
+ // Woken by event.
return nil
case <-interrupt:
+ region.End()
t.SleepFinish(false)
// Return the indicated error on interrupt.
return syserror.ErrInterrupted
case <-timerChan:
- // We've timed out.
+ region.End()
t.SleepFinish(true)
+ // We've timed out.
return syserror.ETIMEDOUT
}
}