Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 175 for newTimer (0.1 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. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. src/cmd/cgo/internal/testcshared/testdata/libgo5/libgo5.go

    //
    //export AwaitSIGIO
    func AwaitSIGIO() {
    	<-sigioChan
    }
    
    // SawSIGIO reports whether we saw a SIGIO within a brief pause.
    //
    //export SawSIGIO
    func SawSIGIO() bool {
    	timer := time.NewTimer(100 * time.Millisecond)
    	select {
    	case <-sigioChan:
    		timer.Stop()
    		return true
    	case <-timer.C:
    		return false
    	}
    }
    
    func main() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Sep 14 13:19:50 UTC 2023
    - 986 bytes
    - Viewed (0)
  10. pkg/queue/util.go

    // WaitForClose an error if the timeout expires.
    func WaitForClose(q Instance, timeout time.Duration) error {
    	closed := q.Closed()
    	if timeout == 0 {
    		<-closed
    		return nil
    	}
    	timer := time.NewTimer(timeout)
    	defer timer.Stop()
    	select {
    	case <-closed:
    		return nil
    	case <-timer.C:
    		return fmt.Errorf("timeout waiting for queue to close after %v", timeout)
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Jul 14 06:36:32 UTC 2022
    - 1.1K bytes
    - Viewed (0)
Back to top