channel _ golang

Channels are the pipes that connect concurrent goroutines. You can send values into channels from one goroutine andreceive those values into another goroutine

package main

import (
    "fmt"
)

func main() {

    messages := make(chan string)

    go func() { messages <- "ping" }()

    msg := <-messages
    fmt.Println(msg)
}
ping

总结 : 

  1 : .......

posted on 2015-03-15 14:54  xjk112  阅读(170)  评论(0编辑  收藏  举报