Source file src/runtime/testdata/testprognet/net.go

     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.
     4  
     5  package main
     6  
     7  import (
     8  	"fmt"
     9  	"net"
    10  )
    11  
    12  func init() {
    13  	registerInit("NetpollDeadlock", NetpollDeadlockInit)
    14  	register("NetpollDeadlock", NetpollDeadlock)
    15  }
    16  
    17  func NetpollDeadlockInit() {
    18  	fmt.Println("dialing")
    19  	c, err := net.Dial("tcp", "localhost:14356")
    20  	if err == nil {
    21  		c.Close()
    22  	} else {
    23  		fmt.Println("error: ", err)
    24  	}
    25  }
    26  
    27  func NetpollDeadlock() {
    28  	fmt.Println("done")
    29  }
    30  

View as plain text