Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 19 for withCancelCause (0.25 sec)

  1. src/context/x_test.go

    			err:   Canceled,
    			cause: Canceled,
    		},
    		{
    			name: "WithCancelCause",
    			ctx: func() Context {
    				ctx, cancel := WithCancelCause(Background())
    				cancel(parentCause)
    				return ctx
    			},
    			err:   Canceled,
    			cause: parentCause,
    		},
    		{
    			name: "WithCancelCause nil",
    			ctx: func() Context {
    				ctx, cancel := WithCancelCause(Background())
    				cancel(nil)
    				return ctx
    			},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 26.3K bytes
    - Viewed (0)
  2. src/cmd/vendor/golang.org/x/sync/errgroup/go120.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    //go:build go1.20
    
    package errgroup
    
    import "context"
    
    func withCancelCause(parent context.Context) (context.Context, func(error)) {
    	return context.WithCancelCause(parent)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:57:25 UTC 2024
    - 335 bytes
    - Viewed (0)
  3. src/cmd/vendor/golang.org/x/sync/errgroup/pre_go120.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    //go:build !go1.20
    
    package errgroup
    
    import "context"
    
    func withCancelCause(parent context.Context) (context.Context, func(error)) {
    	ctx, cancel := context.WithCancel(parent)
    	return ctx, func(error) { cancel() }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:57:25 UTC 2024
    - 377 bytes
    - Viewed (0)
  4. src/context/example_test.go

    		ctx, cancel := context.WithCancelCause(ctx)
    		stop := context.AfterFunc(cancelCtx, func() {
    			cancel(context.Cause(cancelCtx))
    		})
    		return ctx, func() {
    			stop()
    			cancel(context.Canceled)
    		}
    	}
    
    	ctx1, cancel1 := context.WithCancelCause(context.Background())
    	defer cancel1(errors.New("ctx1 canceled"))
    
    	ctx2, cancel2 := context.WithCancelCause(context.Background())
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 21 20:24:28 UTC 2023
    - 6.7K bytes
    - Viewed (0)
  5. src/context/context.go

    type CancelCauseFunc func(cause error)
    
    // WithCancelCause behaves like [WithCancel] but returns a [CancelCauseFunc] instead of a [CancelFunc].
    // Calling cancel with a non-nil error (the "cause") records that error in ctx;
    // it can then be retrieved using Cause(ctx).
    // Calling cancel with nil sets the cause to Canceled.
    //
    // Example use:
    //
    //	ctx, cancel := context.WithCancelCause(parent)
    //	cancel(myError)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 23.7K bytes
    - Viewed (0)
  6. src/cmd/vendor/golang.org/x/sync/errgroup/errgroup.go

    // returns a non-nil error or the first time Wait returns, whichever occurs
    // first.
    func WithContext(ctx context.Context) (*Group, context.Context) {
    	ctx, cancel := withCancelCause(ctx)
    	return &Group{cancel: cancel}, ctx
    }
    
    // Wait blocks until all function calls from the Go method have returned, then
    // returns the first non-nil error (if any) from them.
    func (g *Group) Wait() error {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:57:25 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  7. src/net/http/transport_internal_test.go

    		if err != nil {
    			t.Error(err)
    			return
    		}
    		connc <- c
    	}()
    
    	tr := new(Transport)
    	req, _ := NewRequest("GET", "http://"+ln.Addr().String(), nil)
    	req = req.WithT(t)
    	ctx, cancel := context.WithCancelCause(context.Background())
    	treq := &transportRequest{Request: req, ctx: ctx, cancel: cancel}
    	cm := connectMethod{targetScheme: "http", targetAddr: ln.Addr().String()}
    	pc, err := tr.getConn(treq, cm)
    	if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 15:57:17 UTC 2024
    - 6.2K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apiserver/pkg/server/genericapiserver_graceful_termination_test.go

    		// the server signals the next steps
    		<-beforeShutdownDelayDurationStep.done()
    	}, nil)
    
    	// start the API server
    	_, ctx := ktesting.NewTestContext(t)
    	stopCtx, stop := context.WithCancelCause(ctx)
    	defer stop(errors.New("test has completed"))
    	runCompletedCh := make(chan struct{})
    	go func() {
    		defer close(runCompletedCh)
    		if err := s.PrepareRun().RunWithContext(stopCtx); err != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 29 18:59:21 UTC 2024
    - 38.3K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiextensions-apiserver/pkg/cmd/server/testing/testserver.go

    	// TODO: this is a candidate for using what is now test/utils/ktesting,
    	// should that become a staging repo.
    	ctx, cancel := context.WithCancelCause(context.Background())
    	var errCh chan error
    	tearDown := func() {
    		// Cancel is stopping apiextensions apiserver and its
    		// delegates, which itself is cleaning up after itself,
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 29 18:59:21 UTC 2024
    - 9K bytes
    - Viewed (1)
  10. staging/src/k8s.io/apiserver/pkg/server/options/serving_test.go

    	}
    
    	for title := range tests {
    		test := tests[title]
    		t.Run(title, func(t *testing.T) {
    			t.Parallel()
    			_, ctx := ktesting.NewTestContext(t)
    			ctx, cancel := context.WithCancelCause(ctx)
    			defer cancel(errors.New("test has completed"))
    
    			// create server cert
    			certDir := "testdata/" + specToName(test.Cert)
    			serverCertBundleFile := filepath.Join(certDir, "cert")
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu May 09 15:52:39 UTC 2024
    - 13.8K bytes
    - Viewed (0)
Back to top