Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 1,571 for chan2 (0.13 sec)

  1. test/typeparam/builtins.go

    package builtins
    
    // close
    
    type C0 interface{ int }
    type C1 interface{ chan int }
    type C2 interface{ chan int | <-chan int }
    type C3 interface{ chan int | chan float32 }
    type C4 interface{ chan int | chan<- int }
    type C5[T any] interface{ ~chan T | chan<- T }
    
    func f1[T C1](ch T) {
    	close(ch)
    }
    
    func f2[T C3](ch T) {
    	close(ch)
    }
    
    func f3[T C4](ch T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 09:04:48 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  2. test/chan/nonblock.go

    import "time"
    
    func i32receiver(c chan int32, strobe chan bool) {
    	if <-c != 123 {
    		panic("i32 value")
    	}
    	strobe <- true
    }
    
    func i32sender(c chan int32, strobe chan bool) {
    	c <- 234
    	strobe <- true
    }
    
    func i64receiver(c chan int64, strobe chan bool) {
    	if <-c != 123456 {
    		panic("i64 value")
    	}
    	strobe <- true
    }
    
    func i64sender(c chan int64, strobe chan bool) {
    	c <- 234567
    	strobe <- true
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Feb 19 06:44:02 UTC 2012
    - 3.9K bytes
    - Viewed (0)
  3. test/typeparam/chansimp.dir/a.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: Wed Jul 28 21:40:40 UTC 2021
    - 5.5K bytes
    - Viewed (0)
  4. src/go/types/exprstring_test.go

    	dup("x.(interface{})"),
    	dup("x.(interface{m(); n(x int); E})"),
    	dup("x.(interface{m(); n(x int) T; E; F})"),
    
    	dup("x.(map[K]V)"),
    
    	dup("x.(chan E)"),
    	dup("x.(<-chan E)"),
    	dup("x.(chan<- chan int)"),
    	dup("x.(chan<- <-chan int)"),
    	dup("x.(<-chan chan int)"),
    	dup("x.(chan (<-chan int))"),
    
    	dup("f()"),
    	dup("f(x)"),
    	dup("int(x)"),
    	dup("f(x, x + y)"),
    	dup("f(s...)"),
    	dup("f(a, s...)"),
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jul 31 17:08:18 UTC 2023
    - 2.5K bytes
    - Viewed (0)
  5. test/fixedbugs/issue43111.go

    package main
    
    var ch chan int
    var x int
    
    func f() int {
    	close(ch)
    	ch = nil
    	return 0
    }
    
    func g() int {
    	ch = nil
    	x = 0
    	return 0
    }
    
    func main() {
    	var nilch chan int
    	var v int
    	var ok bool
    	_, _ = v, ok
    
    	ch = make(chan int)
    	select {
    	case <-ch:
    	case nilch <- f():
    	}
    
    	ch = make(chan int)
    	select {
    	case v = <-ch:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 11 22:02:02 UTC 2020
    - 896 bytes
    - Viewed (0)
  6. test/fixedbugs/issue6847.go

    package p
    
    type I1 interface {
    	String()
    }
    type I2 interface {
    	String()
    }
    
    func F() {
    	var (
    		cr <-chan int
    		cs chan<- int
    		c  chan int
    
    		ccr chan (<-chan int)
    		ccs chan chan<- int
    		cc  chan chan int
    
    		ok bool
    	)
    	// Send cases.
    	select {
    	case ccr <- cr:
    	case ccr <- c:
    	}
    	select {
    	case ccs <- cs:
    	case ccs <- c:
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 1.2K bytes
    - Viewed (0)
  7. test/codegen/fuse.go

    // ---------------------------------- //
    
    func si1c(c <-chan int64) {
    	// amd64:"CMPQ\t.+, [$]256"
    	// s390x:"CLGIJ\t[$]12, R[0-9]+, [$]255"
    	for x := <-c; x >= 0 && x < 256; x = <-c {
    	}
    }
    
    func si2c(c <-chan int32) {
    	// amd64:"CMPL\t.+, [$]256"
    	// s390x:"CLIJ\t[$]12, R[0-9]+, [$]255"
    	for x := <-c; x >= 0 && x < 256; x = <-c {
    	}
    }
    
    func si3c(c <-chan int16) {
    	// amd64:"CMPW\t.+, [$]256"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 03 14:30:26 UTC 2020
    - 4.8K bytes
    - Viewed (0)
  8. src/runtime/race/testdata/slice_test.go

    	a := make([]int, 10)
    	ch := make(chan bool, 1)
    	go func() {
    		a[1] = 1
    		ch <- true
    	}()
    	a[1] = 2
    	<-ch
    }
    
    func TestNoRaceArrayWW(t *testing.T) {
    	var a [5]int
    	ch := make(chan bool, 1)
    	go func() {
    		a[0] = 1
    		ch <- true
    	}()
    	a[1] = 2
    	<-ch
    }
    
    func TestRaceArrayWW(t *testing.T) {
    	var a [5]int
    	ch := make(chan bool, 1)
    	go func() {
    		a[1] = 1
    		ch <- true
    	}()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 25 23:41:03 UTC 2020
    - 8.9K bytes
    - Viewed (0)
  9. src/runtime/race/testdata/mop_test.go

    func TestRaceForTest(t *testing.T) {
    	done := make(chan bool)
    	c := make(chan bool)
    	stop := false
    	go func() {
    		for {
    			_, ok := <-c
    			if !ok {
    				done <- true
    				return
    			}
    			stop = true
    		}
    	}()
    	for !stop {
    		c <- true
    	}
    	close(c)
    	<-done
    }
    
    func TestRaceForIncr(t *testing.T) {
    	done := make(chan bool)
    	c := make(chan bool)
    	x := 0
    	go func() {
    		for {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 23 16:46:25 UTC 2023
    - 28.9K bytes
    - Viewed (0)
  10. test/typeparam/issue47901.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package main
    
    type Chan[T any] chan Chan[T]
    
    func (ch Chan[T]) recv() Chan[T] {
    	return <-ch
    }
    
    func main() {
    	ch := Chan[int](make(chan Chan[int]))
    	go func() {
    		ch <- make(Chan[int])
    	}()
    	ch.recv()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 372 bytes
    - Viewed (0)
Back to top