Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for sharedcancel (0.13 sec)

  1. src/context/benchmark_test.go

    import (
    	. "context"
    	"fmt"
    	"runtime"
    	"sync"
    	"testing"
    	"time"
    )
    
    func BenchmarkCommonParentCancel(b *testing.B) {
    	root := WithValue(Background(), "key", "value")
    	shared, sharedcancel := WithCancel(root)
    	defer sharedcancel()
    
    	b.ResetTimer()
    	b.RunParallel(func(pb *testing.PB) {
    		x := 0
    		for pb.Next() {
    			ctx, cancel := WithCancel(shared)
    			if ctx.Value("key").(string) != "value" {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Oct 02 00:44:24 UTC 2021
    - 3.8K bytes
    - Viewed (0)
Back to top