github.com/cocotyty/oneshot@v0.0.0-20210707064948-4d5a81d0b747/README.md (about) 1 OneShot (一发) 2 --- 3 OneShot provide a high performance way for pause and resume goroutine once. 4 5 ## Example 6 7 ```go 8 package main 9 10 import ( 11 "github.com/cocotyty/oneshot" 12 "log" 13 "time" 14 ) 15 16 func main() { 17 s := &oneshot.Shot{} 18 go func() { 19 time.Sleep(time.Second) 20 s.WakeUp() 21 }() 22 log.Println("wait") 23 s.Wait() 24 log.Println("finished") 25 } 26 ```