File: channel.go

package info (click to toggle)
ruby-em-synchrony 1.0.5-3.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 572 kB
  • sloc: ruby: 3,458; sh: 37; sql: 7; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 214 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package main

import (
  "fmt"
  "time"
)

func main() {
  c := make(chan string)

  go func() {
    time.Sleep(1)
    c <- "go go go sleep 1!"
   }()

   fmt.Printf("%v\n", <-c)  // Wait for goroutine to finish
}