Skip to content

Instantly share code, notes, and snippets.

@kreshikhin
Created February 6, 2014 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kreshikhin/8852750 to your computer and use it in GitHub Desktop.
Save kreshikhin/8852750 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
c := make(chan int) // создаёт int-канал
go (func(a, b int){ // создаёт поток для функции прямого вызова
c <- a + b
})(1, 2)
result := <-c // ожидает результат, тут выполнение останавливается
fmt.Println(result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment