Search Options

Results per page
Sort
Preferred Languages
Advance

Results 121 - 130 of 1,571 for chan2 (0.04 sec)

  1. test/chan/select2.go

    package main
    
    import "runtime"
    
    func sender(c chan int, n int) {
    	for i := 0; i < n; i++ {
    		c <- 1
    	}
    }
    
    func receiver(c, dummy chan int, n int) {
    	for i := 0; i < n; i++ {
    		select {
    		case <-c:
    			// nothing
    		case <-dummy:
    			panic("dummy")
    		}
    	}
    }
    
    func main() {
    	runtime.MemProfileRate = 0
    
    	c := make(chan int)
    	dummy := make(chan int)
    
    	// warm up
    	go sender(c, 100000)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 1K bytes
    - Viewed (0)
  2. src/cmd/go/internal/par/queue.go

    // active work items is limited, and excess items are queued sequentially.
    type Queue struct {
    	maxActive int
    	st        chan queueState
    }
    
    type queueState struct {
    	active  int // number of goroutines processing work; always nonzero when len(backlog) > 0
    	backlog []func()
    	idle    chan struct{} // if non-nil, closed when active becomes 0
    }
    
    // NewQueue returns a Queue that executes up to maxActive items in parallel.
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 24 21:08:46 UTC 2020
    - 1.9K bytes
    - Viewed (0)
  3. src/internal/types/testdata/fixedbugs/issue60562.go

    // license that can be found in the LICENSE file.
    
    package p
    
    type S[T any] struct{}
    
    func (S[T]) m(T) {}
    
    func f0[T any](chan S[T]) {}
    
    func _() {
    	var x chan interface{ m(int) }
    	f0(x /* ERROR "type chan interface{m(int)} of x does not match chan S[T] (cannot infer T)" */)
    }
    
    // variants of the theme
    
    func f1[T any]([]S[T]) {}
    
    func _() {
    	var x []interface{ m(int) }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 06 14:52:02 UTC 2023
    - 1.2K bytes
    - Viewed (0)
  4. test/typeparam/append.go

    package main
    
    type Recv <-chan int
    
    type sliceOf[E any] interface {
    	~[]E
    }
    
    func _Append[S sliceOf[T], T any](s S, t ...T) S {
    	return append(s, t...)
    }
    
    func main() {
    	recv := make(Recv)
    	a := _Append([]Recv{recv}, recv)
    	if len(a) != 2 || a[0] != recv || a[1] != recv {
    		panic(a)
    	}
    
    	recv2 := make(chan<- int)
    	a2 := _Append([]chan<- int{recv2}, recv2)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 597 bytes
    - Viewed (0)
  5. test/convert3.go

    // license that can be found in the LICENSE file.
    
    // Verify allowed and disallowed conversions.
    // Does not compile.
    
    package main
    
    // everything here is legal except the ERROR line
    
    var c chan int
    var d1 chan<- int = c
    var d2 = (chan<- int)(c)
    
    var e *[4]int
    var f1 []int = e[0:]
    var f2 = []int(e[0:])
    
    var g = []int(nil)
    
    type H []int
    type J []int
    
    var h H
    var j1 J = h // ERROR "compat|illegal|cannot"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Feb 19 02:19:43 UTC 2012
    - 544 bytes
    - Viewed (0)
  6. pkg/queue/instance_test.go

    	})
    
    	go q.Run(stop)
    
    	// wait for the task to run twice.
    	wg.Wait()
    }
    
    func TestResourceFree(t *testing.T) {
    	q := NewQueue(1 * time.Microsecond)
    	stop := make(chan struct{})
    	signal := make(chan struct{})
    	go func() {
    		q.Run(stop)
    		signal <- struct{}{}
    	}()
    
    	q.Push(func() error {
    		t.Log("mock exec")
    		return nil
    	})
    
    	// mock queue block wait cond signal
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Jul 21 16:30:36 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  7. cni/pkg/util/pluginutil.go

    	"encoding/json"
    	"fmt"
    	"os"
    
    	"github.com/fsnotify/fsnotify"
    
    	"istio.io/istio/pkg/file"
    	"istio.io/istio/pkg/log"
    )
    
    type Watcher struct {
    	watcher *fsnotify.Watcher
    	Events  chan struct{}
    	Errors  chan error
    }
    
    // Waits until a file is modified (returns nil), the context is cancelled (returns context error), or returns error
    func (w *Watcher) Wait(ctx context.Context) error {
    	select {
    	case <-w.Events:
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Jan 26 20:34:28 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  8. pkg/windows/service/service.go

    )
    
    type handler struct {
    	tosvc   chan bool
    	fromsvc chan error
    }
    
    // InitService is the entry point for running the daemon as a Windows
    // service. It returns an indication of whether it is running as a service;
    // and an error.
    func InitService(serviceName string) error {
    	h := &handler{
    		tosvc:   make(chan bool),
    		fromsvc: make(chan error),
    	}
    
    	var err error
    	go func() {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 24 11:25:33 UTC 2022
    - 3.3K bytes
    - Viewed (0)
  9. internal/store/store.go

    type Key struct {
    	Name   string
    	IsLast bool
    }
    
    // replayItems - Reads the items from the store and replays.
    func replayItems[I any](store Store[I], doneCh <-chan struct{}, log logger, id string) <-chan Key {
    	keyCh := make(chan Key)
    
    	go func() {
    		defer xioutil.SafeClose(keyCh)
    
    		retryTicker := time.NewTicker(retryInterval)
    		defer retryTicker.Stop()
    
    		for {
    			names, err := store.List()
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Mon Mar 25 16:44:20 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  10. pkg/filewatcher/fakefilewatcher.go

    // FakeWatcher provides a fake file watcher implementation for unit
    // tests. Production code should use the `NewWatcher()`.
    type FakeWatcher struct {
    	sync.Mutex
    
    	events      map[string]chan fsnotify.Event
    	errors      map[string]chan error
    	changedFunc func(path string, added bool)
    }
    
    // InjectEvent injects an event into the fake file watcher.
    func (w *FakeWatcher) InjectEvent(path string, event fsnotify.Event) {
    	w.Lock()
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 24 14:06:41 UTC 2023
    - 3.6K bytes
    - Viewed (0)
Back to top