Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for afterFunc (0.13 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/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)
  10. src/os/os_unix_test.go

    		// We won't be waiting this long anyhow.
    		timeToWrite = 1 * time.Second
    	}
    
    	// Try to read with deadline (but don't block forever).
    	b := make([]byte, 1)
    	timer := time.AfterFunc(timeToWrite, func() { syscall.Write(p[1], []byte("a")) })
    	defer timer.Stop()
    	file.SetReadDeadline(time.Now().Add(timeToDeadline))
    	_, err := file.Read(b)
    	if !blocking {
    		// We want it to fail with a timeout.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 18 17:32:43 UTC 2023
    - 11.5K bytes
    - Viewed (0)
Back to top