- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 20 for afterFunc (0.14 sec)
-
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) -
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) -
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) -
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) -
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) -
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) -
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) -
src/vendor/golang.org/x/net/nettest/conntest.go
t.Helper() c1, c2, stop, err := mp() if err != nil { t.Fatalf("unable to make pipe: %v", err) } var once sync.Once defer once.Do(func() { stop() }) timer := time.AfterFunc(time.Minute, func() { once.Do(func() { t.Error("test timed out; terminating pipe") stop() }) }) defer timer.Stop() f(t, c1, c2) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Jun 04 16:19:04 UTC 2024 - 12.2K bytes - Viewed (0) -
pkg/adsc/adsc.go
func (a *ADSC) reconnect() { a.mutex.RLock() if a.closed { a.mutex.RUnlock() return } a.mutex.RUnlock() err := a.Run() if err != nil { // TODO: fix reconnect time.AfterFunc(a.cfg.BackoffPolicy.NextBackOff(), a.reconnect) } } func (a *ADSC) handleRecv() { // We connected, so reset the backoff if a.cfg.BackoffPolicy != nil { a.cfg.BackoffPolicy.Reset() } for {
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Mon Feb 05 22:18:49 UTC 2024 - 35K bytes - Viewed (0) -
src/cmd/cgo/internal/testsanitizers/cc_test.go
t.Fatalf("%v: %v", cmd, err) } if deadline, ok := t.Deadline(); ok { timeout := time.Until(deadline) timeout -= timeout / 10 // Leave 10% headroom for logging and cleanup. timer := time.AfterFunc(timeout, func() { cmd.Process.Signal(syscall.SIGQUIT) }) defer timer.Stop() } if err := cmd.Wait(); err != nil { t.Fatalf("%v exited with %v\n%s", cmd, err, out) } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Feb 09 20:00:56 UTC 2024 - 14.4K bytes - Viewed (0)