On Sun, Aug 06, 2017 at 12:53:08AM -0700, desaiabhi...@gmail.com wrote:
> Can you please help with below code to get output at specific cutoff time
> and exit
[...]
> c1 := make(chan string)
>
> go func() { //Sending data after certain time
>
> c1 <- "result 1"
>
>
Hi
What are you trying to solve? Your channel has a capacity of 1, the first write
to c1 is successful but the second write to c1 is blocked until it has been
read in the select statement. And therefore you print the first value written
to c1.
I recommend you to read this https://golang.org/d
Can you please help with below code to get output at specific cutoff time
and exit
Thanks in advance
Abhi
package main
import "time"
import "fmt"
func main() {
c1 := make(chan string)
go func() { //Sending data after certain time
c1 <- "result 1"
time.Sleep