Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 192 for newTimer (0.24 sec)

  1. src/time/sleep.go

    // compare linknamed symbol definitions happier.
    //
    //go:linkname newTimer
    func newTimer(when, period int64, f func(any, uintptr, int64), arg any, cp unsafe.Pointer) *Timer
    
    //go:linkname stopTimer
    func stopTimer(*Timer) bool
    
    //go:linkname resetTimer
    func resetTimer(t *Timer, when, period int64) bool
    
    // Note: The runtime knows the layout of struct Timer, since newTimer allocates it.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:21:30 UTC 2024
    - 8.5K bytes
    - Viewed (0)
  2. src/crypto/cipher/fuzz_test.go

    		c, _ := aes.NewCipher(ft.key)
    
    		cbcAsm := cipher.NewCBCEncrypter(c, commonIV)
    		cbcGeneric := cipher.NewCBCGenericEncrypter(c, commonIV)
    
    		if testing.Short() {
    			timeout = time.NewTimer(10 * time.Millisecond)
    		} else {
    			timeout = time.NewTimer(2 * time.Second)
    		}
    
    		indata := make([]byte, datalen)
    		outgeneric := make([]byte, datalen)
    		outdata := make([]byte, datalen)
    
    	fuzzencrypt:
    		for {
    			select {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 03 13:39:12 UTC 2022
    - 2K bytes
    - Viewed (0)
  3. src/runtime/race/testdata/time_test.go

    	_ = v
    	c := make(chan int)
    	f := func() {
    		v = 1
    		c <- 0
    	}
    	v = 2
    	t := time.NewTimer(1)
    	go func() {
    		<-t.C
    		f()
    	}()
    	<-c
    	v = 3
    }
    
    func TestNoRaceTimerReset(_ *testing.T) {
    	v := 0
    	_ = v
    	c := make(chan int)
    	f := func() {
    		v = 1
    		c <- 0
    	}
    	t := time.NewTimer(time.Hour)
    	go func() {
    		<-t.C
    		f()
    	}()
    	t.Stop()
    	v = 2
    	t.Reset(1)
    	<-c
    	v = 3
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 22:34:15 UTC 2024
    - 1.3K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apimachinery/pkg/util/wait/delay.go

    // Use Backoff{...}.Timer() for simple delays and more efficient timers.
    func (fn DelayFunc) Timer(c clock.Clock) Timer {
    	return &variableTimer{fn: fn, new: c.NewTimer}
    }
    
    // Until takes an arbitrary delay function and runs until cancelled or the condition indicates exit. This
    // offers all of the functionality of the methods in this package.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Mar 14 19:14:11 UTC 2023
    - 1.7K bytes
    - Viewed (0)
  5. src/time/sleep_test.go

    	"math/rand"
    	"runtime"
    	"strings"
    	"sync"
    	"sync/atomic"
    	"testing"
    	. "time"
    	_ "unsafe" // for go:linkname
    )
    
    // newTimerFunc simulates NewTimer using AfterFunc,
    // but this version will not hit the special cases for channels
    // that are used when calling NewTimer.
    // This makes it easy to test both paths.
    func newTimerFunc(d Duration) *Timer {
    	c := make(chan Time, 1)
    	t := AfterFunc(d, func() { c <- Now() })
    	t.C = c
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 22 16:33:57 UTC 2024
    - 22.5K bytes
    - Viewed (0)
  6. src/time/tick.go

    // license that can be found in the LICENSE file.
    
    package time
    
    import "unsafe"
    
    // Note: The runtime knows the layout of struct Ticker, since newTimer allocates it.
    // Note also that Ticker and Timer have the same layout, so that newTimer can handle both.
    // The initTimer and initTicker fields are named differently so that
    // users cannot convert between the two without unsafe.
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:21:30 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apiserver/pkg/storage/cacher/watch_progress.go

    		contextMetadata:      contextMetadata,
    	}
    	pr.cond = sync.NewCond(&pr.mux)
    	return pr
    }
    
    type WatchProgressRequester func(ctx context.Context) error
    
    type TickerFactory interface {
    	NewTimer(time.Duration) clock.Timer
    }
    
    // conditionalProgressRequester will request progress notification if there
    // is a request waiting for watch cache to be fresh.
    type conditionalProgressRequester struct {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri May 24 09:56:38 UTC 2024
    - 3K bytes
    - Viewed (0)
  8. pkg/test/framework/components/echo/util/traffic/generator.go

    type generator struct {
    	Config
    	t       test.Failer
    	result  Result
    	stop    chan struct{}
    	stopped chan struct{}
    }
    
    func (g *generator) Start() Generator {
    	go func() {
    		t := time.NewTimer(g.Interval)
    		for {
    			select {
    			case <-g.stop:
    				t.Stop()
    				close(g.stopped)
    				return
    			case <-t.C:
    				g.result.add(g.Source.Call(g.Options))
    				t.Reset(g.Interval)
    			}
    		}
    	}()
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Apr 12 22:50:35 UTC 2022
    - 3.1K bytes
    - Viewed (0)
  9. src/cmd/go/internal/lockedfile/lockedfile_test.go

    	t.Helper()
    
    	done := make(chan struct{})
    	go func() {
    		f()
    		close(done)
    	}()
    
    	timer := time.NewTimer(quiescent)
    	defer timer.Stop()
    	select {
    	case <-done:
    		t.Fatalf("%s unexpectedly did not block", desc)
    	case <-timer.C:
    	}
    
    	return func(t *testing.T) {
    		logTimer := time.NewTimer(quiescent)
    		defer logTimer.Stop()
    
    		select {
    		case <-logTimer.C:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 05 23:35:29 UTC 2023
    - 5.7K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apiserver/pkg/storage/cacher/cache_watcher_test.go

    		t.Fatal("failed adding an even to the watcher")
    	}
    	if !w.add(&watchCacheEvent{Object: makePod(15), ResourceVersion: 15}, time.NewTimer(1*time.Second)) {
    		t.Fatal("failed adding an even to the watcher")
    	}
    	if w.add(&watchCacheEvent{Object: makePod(20), ResourceVersion: 20}, time.NewTimer(1*time.Second)) {
    		t.Fatal("expected the add method to fail")
    	}
    	if err := wait.PollImmediate(1*time.Second, 5*time.Second, func() (bool, error) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jun 04 09:20:10 UTC 2024
    - 22.9K bytes
    - Viewed (0)
Back to top