1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 type response
struct {
19 func (myError
) Error() string { return "" }
21 func doRequest(useSelect
bool) (*response
, error
) {
26 ch
:= make(chan *async
, 0)
27 done
:= make(chan struct{}, 0)
32 case ch
<- &async
{resp
: nil, err
: myError
{}}:
38 ch
<- &async
{resp
: nil, err
: myError
{}}
47 func TestChanSendSelectBarrier(t
*testing
.T
) {
48 testChanSendBarrier(true)
51 func TestChanSendBarrier(t
*testing
.T
) {
52 testChanSendBarrier(false)
55 func testChanSendBarrier(useSelect
bool) {
57 var globalMu sync
.Mutex
64 for i
:= 0; i
< outer
; i
++ {
69 for j
:= 0; j
< inner
; j
++ {
70 _
, err
:= doRequest(useSelect
)
71 _
, ok
:= err
.(myError
)
75 garbage
= make([]byte, 1<<10)