Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/Events/Go/events.go
Normal file
23
Task/Events/Go/events.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
l := log.New(os.Stdout, "", log.Ltime | log.Lmicroseconds)
|
||||
l.Println("program start")
|
||||
event := make(chan int)
|
||||
go func() {
|
||||
l.Println("task start")
|
||||
<-event
|
||||
l.Println("event reset by task")
|
||||
}()
|
||||
l.Println("program sleeping")
|
||||
time.Sleep(1 * time.Second)
|
||||
l.Println("program signaling event")
|
||||
event <- 0
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue