Skip to content

Instantly share code, notes, and snippets.

@lamarmarshall
Last active October 26, 2017 21:57
Show Gist options
  • Save lamarmarshall/69d596d6031110d3f225ba2d8f420766 to your computer and use it in GitHub Desktop.
Save lamarmarshall/69d596d6031110d3f225ba2d8f420766 to your computer and use it in GitHub Desktop.
go chan concurrent stream threads
package main
import (
"fmt"
"time"
)
func main(){
stream := make( chan int)
go sendStream(stream)
for c := range stream {
fmt.Println
}
}
func sendStream(ch chan int){
for{
ch <- 3
time.Sleep(3*time.Second)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment