Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 192 for newTimer (0.37 sec)

  1. 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)
  2. 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)
  3. pkg/sleep/sleep.go

    }
    
    // Until sleeps for the given duration, or until the channel is closed.
    // Returns true if the sleep completes the full duration
    func Until(ch <-chan struct{}, d time.Duration) bool {
    	timer := time.NewTimer(d)
    	select {
    	case <-ch:
    		if !timer.Stop() {
    			<-timer.C
    		}
    		return false
    	case <-timer.C:
    		return true
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Sep 07 14:36:37 UTC 2022
    - 1.2K bytes
    - Viewed (0)
  4. 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)
  5. 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)
  6. staging/src/k8s.io/apiserver/pkg/admission/configuration/configuration_manager_test.go

    	poller.failureThreshold = 0
    	stopCh := make(chan struct{})
    	defer close(stopCh)
    	go poller.Run(stopCh)
    	go func() {
    		// The test might have false negative, but won't be flaky
    		timer := time.NewTimer(2 * time.Second)
    		defer timer.Stop()
    		<-timer.C
    		fakeGetSucceedLock.Lock()
    		defer fakeGetSucceedLock.Unlock()
    		fakeGetSucceed = true
    	}()
    
    	done := make(chan struct{})
    	go func(t *testing.T) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Nov 06 02:02:38 UTC 2017
    - 2.4K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apimachinery/pkg/util/wait/backoff.go

    // Timer returns a timer implementation appropriate to this backoff's parameters
    // for use with wait functions.
    func (b Backoff) Timer() Timer {
    	if b.Steps > 1 || b.Jitter != 0 {
    		return &variableTimer{new: internalClock.NewTimer, fn: b.DelayFunc()}
    	}
    	if b.Duration > 0 {
    		return &fixedTimer{new: internalClock.NewTicker, interval: b.Duration}
    	}
    	return newNoopTimer()
    }
    
    // delay implements the core delay algorithm used in this package.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Mar 14 19:14:11 UTC 2023
    - 16.5K bytes
    - Viewed (0)
  8. 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)
  9. 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)
  10. pkg/bootstrap/platform/discovery.go

    	}()
    
    	go func() {
    		if IsAzure() {
    			log.Info("platform detected is Azure")
    			plat <- NewAzure()
    		}
    		wg.Done()
    	}()
    
    	go func() {
    		wg.Wait()
    		close(done)
    	}()
    
    	timer := time.NewTimer(timeout)
    	defer timer.Stop()
    	select {
    	case p := <-plat:
    		return p
    	case <-done:
    		select {
    		case p := <-plat:
    			return p
    		default:
    			return &Unknown{}
    		}
    	case <-timer.C:
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 2.6K bytes
    - Viewed (0)
Back to top