Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for withCancelCause (0.26 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/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)
  3. 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)
  4. 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)
  5. staging/src/k8s.io/apiserver/pkg/server/config_test.go

    				}
    			}
    		}
    	}
    }
    
    func TestNewWithDelegate(t *testing.T) {
    	_, ctx := ktesting.NewTestContext(t)
    	ctx, cancel := context.WithCancelCause(ctx)
    	defer cancel(errors.New("test is done"))
    	delegateConfig := NewConfig(codecs)
    	delegateConfig.ExternalAddress = "192.168.10.4:443"
    	delegateConfig.PublicAddress = netutils.ParseIPSloppy("192.168.10.4")
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 29 18:59:21 UTC 2024
    - 13.1K bytes
    - Viewed (0)
  6. pkg/kubelet/cm/dra/plugin/noderesources.go

    	defer c.mutex.Unlock()
    
    	if active := c.activePlugins[driverName]; active != nil {
    		active.cancel(errors.New("plugin has re-registered"))
    	}
    	active := &activePlugin{}
    	cancelCtx, cancel := context.WithCancelCause(c.ctx)
    	active.cancel = cancel
    	c.activePlugins[driverName] = active
    	c.queue.Add(driverName)
    
    	c.wg.Add(1)
    	go func() {
    		defer c.wg.Done()
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 27 20:12:53 UTC 2024
    - 16.6K bytes
    - Viewed (0)
  7. internal/grid/muxclient.go

    }
    
    // Response is a response from the server.
    type Response struct {
    	Msg []byte
    	Err error
    }
    
    func newMuxClient(ctx context.Context, muxID uint64, parent *Connection) *muxClient {
    	ctx, cancelFn := context.WithCancelCause(ctx)
    	return &muxClient{
    		MuxID:              muxID,
    		ctx:                ctx,
    		cancelFn:           cancelFn,
    		parent:             parent,
    		LastPong:           time.Now().UnixNano(),
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Fri Jun 07 15:51:52 UTC 2024
    - 15.9K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apiserver/pkg/server/genericapiserver.go

    	// Canceling the parent context does not immediately cancel the HTTP server.
    	// We only inherit context values here and deal with cancellation ourselves.
    	stopHTTPServerCtx, stopHTTPServer := context.WithCancelCause(context.WithoutCancel(ctx))
    	go func() {
    		defer stopHTTPServer(errors.New("time to stop HTTP server"))
    
    		timeToStopHttpServerCh := notAcceptingNewRequestCh.Signaled()
    		if s.ShutdownSendRetryAfter {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 29 18:59:21 UTC 2024
    - 42.9K bytes
    - Viewed (0)
  9. internal/grid/connection.go

    // handleMessages will handle incoming messages on conn.
    // caller *must* hold reconnectMu.
    func (c *Connection) handleMessages(ctx context.Context, conn net.Conn) {
    	c.updateState(StateConnected)
    	ctx, cancel := context.WithCancelCause(ctx)
    	defer cancel(ErrDisconnected)
    
    	// This will ensure that is something asks to disconnect and we are blocked on reads/writes
    	// the connection will be closed and readers/writers will unblock.
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Fri Jun 07 15:51:52 UTC 2024
    - 44.8K bytes
    - Viewed (0)
Back to top