Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for makeChan (0.22 sec)

  1. src/reflect/value.go

    }
    
    // MakeChan creates a new channel with the specified type and buffer size.
    func MakeChan(typ Type, buffer int) Value {
    	if typ.Kind() != Chan {
    		panic("reflect.MakeChan of non-chan type")
    	}
    	if buffer < 0 {
    		panic("reflect.MakeChan: negative buffer size")
    	}
    	if typ.ChanDir() != BothDir {
    		panic("reflect.MakeChan: unidirectional channel type")
    	}
    	t := typ.common()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 21:17:41 UTC 2024
    - 119.9K bytes
    - Viewed (0)
  2. src/reflect/all_test.go

    	// check creation of unbuffered channel
    	var c chan int
    	cv := MakeChan(TypeOf(c), 0)
    	c = cv.Interface().(chan int)
    	if cv.TrySend(ValueOf(7)) {
    		t.Errorf("TrySend on sync chan succeeded")
    	}
    	if v, ok := cv.TryRecv(); v.IsValid() || ok {
    		t.Errorf("TryRecv on sync chan succeeded: isvalid=%v ok=%v", v.IsValid(), ok)
    	}
    
    	// len/cap
    	cv = MakeChan(TypeOf(c), 10)
    	c = cv.Interface().(chan int)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 218.8K bytes
    - Viewed (0)
Back to top