diff options
Diffstat (limited to 'src/context/benchmark_test.go')
-rw-r--r-- | src/context/benchmark_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/context/benchmark_test.go b/src/context/benchmark_test.go index 5d56863050..69d75fff18 100644 --- a/src/context/benchmark_test.go +++ b/src/context/benchmark_test.go @@ -138,3 +138,17 @@ func BenchmarkCheckCanceled(b *testing.B) { } }) } + +func BenchmarkContextCancelDone(b *testing.B) { + ctx, cancel := WithCancel(Background()) + defer cancel() + + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + select { + case <-ctx.Done(): + default: + } + } + }) +} |