channel/unlimited_runner.go

20 lines
417 B
Go
Raw Permalink Normal View History

2022-02-09 12:10:02 +01:00
package channel
// UnlimitedRunner is a Runner which runs each method
// in its own routine
type UnlimitedRunner struct {
}
var _ Runner = &UnlimitedRunner{}
// NewUnlimitedRunner returns a new LimitedRunner with the given amount
// of allowed routines
func NewUnlimitedRunner() *UnlimitedRunner {
return &UnlimitedRunner{}
}
// Run always returns immediately
func (r *UnlimitedRunner) Run(f func()) {
go f()
}