Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 1,297 for chan2 (0.05 sec)

  1. src/internal/fmtsort/sort_test.go

    			}
    		}
    		return "UNSAFEPTR???"
    	case "chan int":
    		c := key.Interface().(chan int)
    		for i := range chans {
    			if c == chans[i] {
    				return fmt.Sprintf("CHAN%d", i)
    			}
    		}
    		return "CHAN???"
    	default:
    		return fmt.Sprint(key)
    	}
    }
    
    var (
    	ints  [3]int
    	chans = makeChans()
    	pin   runtime.Pinner
    )
    
    func makeChans() []chan int {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 6.9K bytes
    - Viewed (0)
  2. src/go/parser/parser_test.go

    	{name: "pointer", format: "package main; var x «*»int"},
    	{name: "func", format: "package main; var x «func()»int", scope: true},
    	{name: "chan", format: "package main; var x «chan »int"},
    	{name: "chan2", format: "package main; var x «<-chan »int"},
    	{name: "interface", format: "package main; var x «interface { M() «int» }»", scope: true, scopeMultiplier: 2}, // Scopes: InterfaceType, FuncType
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 31 20:26:14 UTC 2024
    - 24.6K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/syntax/testdata/chans.go

    func Ranger[T any]() (*Sender[T], *Receiver[T]) {
    	c := make(chan T)
    	d := make(chan bool)
    	s := &Sender[T]{values: c, done: d}
    	r := &Receiver[T]{values: c, done: d}
    	runtime.SetFinalizer(r, r.finalize)
    	return s, r
    }
    
    // A sender is used to send values to a Receiver.
    type Sender[T any] struct {
    	values chan<- T
    	done   <-chan bool
    }
    
    // Send sends a value to the receiver. It returns whether any more
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 30 18:02:18 UTC 2022
    - 1.8K bytes
    - Viewed (0)
  4. src/internal/types/testdata/check/chans.go

    func Ranger[T any]() (*Sender[T], *Receiver[T]) {
    	c := make(chan T)
    	d := make(chan bool)
    	s := &Sender[T]{values: c, done: d}
    	r := &Receiver[T]{values: c, done: d}
    	runtime.SetFinalizer(r, r.finalize)
    	return s, r
    }
    
    // A sender is used to send values to a Receiver.
    type Sender[T any] struct {
    	values chan<- T
    	done <-chan bool
    }
    
    // Send sends a value to the receiver. It returns whether any more
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 02 02:58:32 UTC 2022
    - 1.7K bytes
    - Viewed (0)
  5. test/typeparam/chans.go

    // or the context is canceled, at which point the returned channel is closed.
    func _Merge[Elem any](ctx context.Context, c1, c2 <-chan Elem) <-chan Elem {
    	r := make(chan Elem)
    	go func(ctx context.Context, c1, c2 <-chan Elem, r chan<- Elem) {
    		defer close(r)
    		for c1 != nil || c2 != nil {
    			select {
    			case <-ctx.Done():
    				return
    			case v1, ok := <-c1:
    				if ok {
    					r <- v1
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 8.4K bytes
    - Viewed (0)
  6. src/go/types/chan.go

    func NewChan(dir ChanDir, elem Type) *Chan {
    	return &Chan{dir: dir, elem: elem}
    }
    
    // Dir returns the direction of channel c.
    func (c *Chan) Dir() ChanDir { return c.dir }
    
    // Elem returns the element type of channel c.
    func (c *Chan) Elem() Type { return c.elem }
    
    func (c *Chan) Underlying() Type { return c }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 1K bytes
    - Viewed (0)
  7. src/runtime/chan.go

    	dataqsiz uint           // size of the circular queue
    	buf      unsafe.Pointer // points to an array of dataqsiz elements
    	elemsize uint16
    	closed   uint32
    	timer    *timer // timer feeding this chan
    	elemtype *_type // element type
    	sendx    uint   // send index
    	recvx    uint   // receive index
    	recvq    waitq  // list of recv waiters
    	sendq    waitq  // list of send waiters
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:16:50 UTC 2024
    - 25.9K bytes
    - Viewed (0)
  8. src/cmd/cgo/internal/testlife/testdata/life.go

    	}
    }
    
    // Keep the channels visible from Go.
    var chans [4]chan bool
    
    // Double return value is just for testing.
    //
    //export GoStart
    func GoStart(i, xdim, ydim, xstart, xend, ystart, yend C.int, a *C.int, n *C.int) (int, int) {
    	c := make(chan bool, int(C.MYCONST))
    	go func() {
    		C.DoStep(xdim, ydim, xstart, xend, ystart, yend, a, n)
    		c <- true
    	}()
    	chans[i] = c
    	return int(i), int(i + 100)
    }
    
    //export GoWait
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 892 bytes
    - Viewed (0)
  9. src/cmd/cgo/internal/testplugin/testdata/issue25756/plugin/life.go

    	}
    }
    
    // Keep the channels visible from Go.
    var chans [4]chan bool
    
    // Double return value is just for testing.
    //
    //export GoStart
    func GoStart(i, xdim, ydim, xstart, xend, ystart, yend C.int, a *C.int, n *C.int) (int, int) {
    	c := make(chan bool, int(C.MYCONST))
    	go func() {
    		C.DoStep(xdim, ydim, xstart, xend, ystart, yend, a, n)
    		c <- true
    	}()
    	chans[i] = c
    	return int(i), int(i + 100)
    }
    
    //export GoWait
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 889 bytes
    - Viewed (0)
  10. src/internal/singleflight/singleflight.go

    // results when they are ready.
    func (g *Group) DoChan(key string, fn func() (any, error)) <-chan Result {
    	ch := make(chan Result, 1)
    	g.mu.Lock()
    	if g.m == nil {
    		g.m = make(map[string]*call)
    	}
    	if c, ok := g.m[key]; ok {
    		c.dups++
    		c.chans = append(c.chans, ch)
    		g.mu.Unlock()
    		return ch
    	}
    	c := &call{chans: []chan<- Result{ch}}
    	c.wg.Add(1)
    	g.m[key] = c
    	g.mu.Unlock()
    
    	go g.doCall(c, key, fn)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 30 20:49:56 UTC 2022
    - 3.1K bytes
    - Viewed (0)
Back to top