Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 120 for newTimer (0.35 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/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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. src/time/internal_test.go

    	// We manually create a runtimeTimer with huge period, but that expires
    	// immediately. The public Timer interface would require waiting for
    	// the entire period before the first update.
    	t := newTimer(runtimeNano(), 1<<63-1, empty, nil, nil)
    	defer t.Stop()
    
    	// If this test fails, we will either throw (when siftdownTimer detects
    	// bad when on update), or other timers will hang (if the timer in a
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 03 14:56:37 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  8. pilot/pkg/serviceregistry/util/xdsfake/updater.go

    	default:
    	}
    	if fx.Delegate != nil {
    		fx.Delegate.RemoveShard(shardKey)
    	}
    }
    
    func (fx *Updater) WaitOrFail(t test.Failer, et string) *Event {
    	t.Helper()
    	delay := time.NewTimer(time.Second * 5)
    	defer delay.Stop()
    	for {
    		select {
    		case e := <-fx.Events:
    			if e.Type == et {
    				return &e
    			}
    			log.Infof("skipping event %q want %q", e.Type, et)
    			continue
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Feb 29 18:40:34 UTC 2024
    - 6.2K bytes
    - Viewed (0)
  9. doc/next/6-stdlib/1-time.md

    is in a module with a `go.mod` `go` line using Go 1.23.0 or later.
    When Go 1.23 builds older programs, the old behaviors remain in effect.
    The new [GODEBUG setting](/doc/godebug) [`asynctimerchan=1`](/pkg/time/#NewTimer)
    can be used to revert back to asynchronous channel behaviors
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 20:49:22 UTC 2024
    - 1.5K bytes
    - Viewed (0)
  10. src/time/tick_test.go

    			}
    		})
    	}
    
    	run(t, "After", func() { After(Hour) })
    	run(t, "Tick", func() { Tick(Hour) })
    	run(t, "NewTimer", func() { NewTimer(Hour) })
    	run(t, "NewTicker", func() { NewTicker(Hour) })
    	run(t, "NewTimerStop", func() { NewTimer(Hour).Stop() })
    	run(t, "NewTickerStop", func() { NewTicker(Hour).Stop() })
    }
    
    func TestChan(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 11 17:10:37 UTC 2024
    - 14.7K bytes
    - Viewed (0)
Back to top