github.com/go-task/task/v3/cmd/sleepit
No package summary is available.
Package
Files: 1. Third party imports: 0. Imports from organisation: 0. Tests: 0. Benchmarks: 0.
Constants
Vars
Filled by the linker.
Private functions
func doSomeWork
Do some work and then return, so that the caller can decide whether to continue or not. Return true when all work is done.
References: time.Millisecond, time.Now, time.Sleep.func main
References: os.Args, os.Exit.
func run
References: flag.ExitOnError, flag.NewFlagSet, fmt.Fprintf, fmt.Fprintln, fmt.Printf, os.Interrupt, os.Signal, os.Stderr, signal.Notify, time.Second.
func supervisor
References: fmt.Printf, os.Getpid.
func worker
Start a worker goroutine and return immediately a workerDone channel.
The goroutine will prepend its prints with the prefix name.
The goroutine will simulate some work and will terminate when one of the following
conditions happens:
- When
howlongis elapsed. This case will be signaled on theworkerDonechannel. - When something happens on channel
canceled. Note that this simulates real-life, so cancellation is not instantaneous: if the caller wants a synchronous cancel, it should send a message; if instead it wants an asynchronous cancel, it should close the channel.