Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 66 for afterFunc (0.24 sec)

  1. 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)
  2. src/go/doc/testdata/testing.go

    		}
    		f.Close()
    	}
    }
    
    var timer *time.Timer
    
    // startAlarm starts an alarm if requested.
    func startAlarm() {
    	if *timeout > 0 {
    		timer = time.AfterFunc(*timeout, alarm)
    	}
    }
    
    // stopAlarm turns off the alarm.
    func stopAlarm() {
    	if *timeout > 0 {
    		timer.Stop()
    	}
    }
    
    // alarm is called if the timeout expires.
    func alarm() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Oct 02 02:28:27 UTC 2022
    - 11.8K bytes
    - Viewed (0)
  3. 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)
  4. 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)
  5. 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)
  6. src/time/tick_test.go

    	// which needed 77 seconds.
    	// Trybots are slower, so it will fail even more reliably there.
    	// With the fix, the code runs in under a second.
    	done := make(chan bool)
    	AfterFunc(60*Second, func() { close(done) })
    
    	// Set up a queuing goroutine to ping pong through the scheduler.
    	inQ := make(chan func())
    	outQ := make(chan func())
    
    	defer close(inQ)
    
    	wg.Add(1)
    	go func() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 11 17:10:37 UTC 2024
    - 14.7K bytes
    - Viewed (0)
  7. src/image/jpeg/reader_test.go

    		"\x20\x36\x9f\x78\x64\x75\xe6\xab\x7d\xb2\xde\x29\x70\xd3\x20\x27" +
    		"\xde\xaf\xa4\xf0\xca\x9f\x24\xa8\xdf\x46\xa8\x24\x84\x96\xe3\x77" +
    		"\xf9\x2e\xe0\x0a\x62\x7f\xdf\xd9"
    
    	timer := time.AfterFunc(30*time.Second, func() {
    		debug.SetTraceback("all")
    		panic("TestLargeImageWithShortData stuck in Decode")
    	})
    	defer timer.Stop()
    
    	_, err := Decode(strings.NewReader(input))
    	if err == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 25 00:46:29 UTC 2024
    - 24.4K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/telemetry/internal/counter/file.go

    func (f *file) rotate() {
    	expire, cleanup := f.rotate1()
    	cleanup()
    	if !expire.IsZero() {
    		// TODO(rsc): Does this do the right thing for laptops closing?
    		time.AfterFunc(time.Until(expire), f.rotate)
    	}
    }
    
    func nop() {}
    
    // CounterTime returns the current UTC time.
    // Mutable for testing.
    var CounterTime = func() time.Time {
    	return time.Now().UTC()
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 16:19:04 UTC 2024
    - 18.2K bytes
    - Viewed (0)
  9. src/net/http/transport.go

    	// (see idleConnTimeout in h2_bundle.go).
    	if t.IdleConnTimeout > 0 && pconn.alt == nil {
    		if pconn.idleTimer != nil {
    			pconn.idleTimer.Reset(t.IdleConnTimeout)
    		} else {
    			pconn.idleTimer = time.AfterFunc(t.IdleConnTimeout, pconn.closeConnIfStillIdle)
    		}
    	}
    	pconn.idleAt = time.Now()
    	return nil
    }
    
    // queueForIdleConn queues w to receive the next idle connection for w.cm.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 06 21:59:21 UTC 2024
    - 91K bytes
    - Viewed (0)
  10. src/net/net_fake.go

    	}
    
    	d := time.Until(deadline)
    	if d < 0 {
    		// Ensure that a deadline in the past takes effect immediately.
    		defer func() { <-dt.expired }()
    	}
    
    	if timer == nil {
    		timer = time.AfterFunc(d, func() { close(dt.expired) })
    		return true
    	}
    	if !timer.Stop() {
    		return false
    	}
    	timer.Reset(d)
    	return true
    }
    
    func sysSocket(family, sotype, proto int) (int, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 27 19:24:21 UTC 2024
    - 26.4K bytes
    - Viewed (0)
Back to top