You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
259 B

  1. package benchmarks
  2. import (
  3. "testing"
  4. )
  5. func BenchmarkChanMakeClose(b *testing.B) {
  6. b.StopTimer()
  7. b.StartTimer()
  8. for j := 0; j < b.N; j++ {
  9. foo := make(chan struct{})
  10. close(foo)
  11. something, ok := <-foo
  12. if ok {
  13. b.Error(something, ok)
  14. }
  15. }
  16. }