Skip to content

cocotyty/oneshot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OneShot (一发)

OneShot provide a high performance way for pause and resume goroutine once.

Example

package main

import (
	"github.com/cocotyty/oneshot"
	"log"
	"time"
)

func main() {
	s := &oneshot.Shot{}
	go func() {
		time.Sleep(time.Second)
		s.WakeUp()
	}()
	log.Println("wait")
	s.Wait()
	log.Println("finished")
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published