aboutsummaryrefslogtreecommitdiff
path: root/src/context/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/context/context.go')
-rw-r--r--src/context/context.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/context/context.go b/src/context/context.go
index f39abe91e2..f3fe1a474e 100644
--- a/src/context/context.go
+++ b/src/context/context.go
@@ -285,6 +285,8 @@ func withCancel(parent Context) *cancelCtx {
// Cause returns nil if c has not been canceled yet.
func Cause(c Context) error {
if cc, ok := c.Value(&cancelCtxKey).(*cancelCtx); ok {
+ cc.mu.Lock()
+ defer cc.mu.Unlock()
return cc.cause
}
return nil