Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 26 for afterFunc (0.27 sec)

  1. src/time/sleep_test.go

    // behavior is tested elsewhere, since After and AfterFunc share
    // the same code.
    func TestAfterFunc(t *testing.T) {
    	i := 10
    	c := make(chan bool)
    	var f func()
    	f = func() {
    		i--
    		if i >= 0 {
    			AfterFunc(0, f)
    			Sleep(1 * Second)
    		} else {
    			c <- true
    		}
    	}
    
    	AfterFunc(0, f)
    	<-c
    }
    
    func TestTickerStress(t *testing.T) {
    	var stop atomic.Bool
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 22 16:33:57 UTC 2024
    - 22.5K bytes
    - Viewed (0)
  2. src/context/x_test.go

    	donec := make(chan struct{})
    	stop := AfterFunc(ctx, func() {
    		close(donec)
    	})
    	select {
    	case <-donec:
    		t.Fatalf("AfterFunc called before context is done")
    	case <-time.After(shortDuration):
    	}
    	cancel()
    	select {
    	case <-donec:
    	case <-time.After(veryLongDuration):
    		t.Fatalf("AfterFunc not called after context is canceled")
    	}
    	if stop() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 26.3K bytes
    - Viewed (0)
  3. src/context/context.go

    	// it might still have an error even though it won't have a cause.
    	return c.Err()
    }
    
    // AfterFunc arranges to call f in its own goroutine after ctx is done
    // (canceled or timed out).
    // If ctx is already done, AfterFunc calls f immediately in its own goroutine.
    //
    // Multiple calls to AfterFunc on a context operate independently;
    // one does not replace another.
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 23.7K bytes
    - Viewed (0)
  4. cni/pkg/nodeagent/ztunnelserver.go

    		},
    		pods: pods,
    	}, nil
    }
    
    func (z *ztunnelServer) Close() error {
    	return z.listener.Close()
    }
    
    func (z *ztunnelServer) Run(ctx context.Context) {
    	context.AfterFunc(ctx, func() { _ = z.Close() })
    
    	for {
    		log.Debug("accepting conn")
    		conn, err := z.accept()
    		if err != nil {
    			if errors.Is(err, net.ErrClosed) {
    				log.Debug("listener closed - returning")
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu May 23 22:07:03 UTC 2024
    - 12.3K bytes
    - Viewed (0)
  5. pilot/pkg/model/network.go

    	}
    	n.cache[name] = nameCacheEntry{
    		value:  addrs,
    		expiry: expiry,
    		// TTL expires, try to refresh TODO should this be < ttl?
    		timer: time.AfterFunc(ttl, n.refreshAndNotify(name)),
    	}
    
    	return addrs
    }
    
    // refreshAndNotify is triggered via time.AfterFunc and will recursively schedule itself that way until timer is cleaned
    // up via cleanupWatches.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Oct 24 03:31:28 UTC 2023
    - 16.9K bytes
    - Viewed (0)
  6. src/net/http/httputil/reverseproxy.go

    	}
    	if m.flushPending {
    		return
    	}
    	if m.t == nil {
    		m.t = time.AfterFunc(m.latency, m.delayedFlush)
    	} else {
    		m.t.Reset(m.latency)
    	}
    	m.flushPending = true
    	return
    }
    
    func (m *maxLatencyWriter) delayedFlush() {
    	m.mu.Lock()
    	defer m.mu.Unlock()
    	if !m.flushPending { // if stop was called but AfterFunc already started this goroutine
    		return
    	}
    	m.flush()
    	m.flushPending = false
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 27 23:37:42 UTC 2024
    - 24.9K bytes
    - Viewed (0)
  7. pkg/adsc/delta.go

    func (c *Client) reconnect() {
    	c.mutex.RLock()
    	if c.closed {
    		c.mutex.RUnlock()
    		return
    	}
    	c.mutex.RUnlock()
    
    	err := c.Run(context.Background())
    	if err != nil {
    		time.AfterFunc(c.cfg.BackoffPolicy.NextBackOff(), c.reconnect)
    	} else if c.cfg.BackoffPolicy != nil {
    		// We connected, so reset the backoff
    		c.cfg.BackoffPolicy.Reset()
    	}
    }
    
    type Option func(c *Client)
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Feb 02 09:32:41 UTC 2024
    - 20.4K bytes
    - Viewed (0)
  8. src/cmd/cgo/internal/testcarchive/carchive_test.go

    	cmd = exec.Command(argv[0], argv[1:]...)
    	sb := new(strings.Builder)
    	cmd.Stdout = sb
    	cmd.Stderr = sb
    	if err := cmd.Start(); err != nil {
    		t.Fatal(err)
    	}
    
    	timer := time.AfterFunc(time.Minute,
    		func() {
    			t.Error("test program timed out")
    			cmd.Process.Kill()
    		},
    	)
    	defer timer.Stop()
    
    	err = cmd.Wait()
    	t.Logf("%v\n%s", cmd.Args, sb)
    	if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 12 00:43:51 UTC 2023
    - 34.8K bytes
    - Viewed (0)
  9. src/runtime/stack_test.go

    		growStack(&progress)
    	})
    	setFinalizerTime := time.Now()
    	s = nil
    
    	if d, ok := t.Deadline(); ok {
    		// Pad the timeout by an arbitrary 5% to give the AfterFunc time to run.
    		timeout := time.Until(d) * 19 / 20
    		timer := time.AfterFunc(timeout, func() {
    			// Panic — instead of calling t.Error and returning from the test — so
    			// that we get a useful goroutine dump if the test times out, especially
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jun 14 00:03:57 UTC 2023
    - 23.1K bytes
    - Viewed (0)
  10. src/net/http/httptest/server.go

    			// in StateActive.
    			if st == http.StateIdle || st == http.StateNew {
    				s.closeConn(c)
    			}
    		}
    		// If this server doesn't shut down in 5 seconds, tell the user why.
    		t := time.AfterFunc(5*time.Second, s.logCloseHangDebugInfo)
    		defer t.Stop()
    	}
    	s.mu.Unlock()
    
    	// Not part of httptest.Server's correctness, but assume most
    	// users of httptest.Server will be using the standard
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 10 17:26:10 UTC 2024
    - 10.7K bytes
    - Viewed (0)
Back to top