Update README.md
This commit is contained in:
parent
d45d913c9e
commit
d4c697cf3a
1 changed files with 16 additions and 16 deletions
32
README.md
32
README.md
|
@ -54,26 +54,26 @@ Default policy:
|
||||||
#### Example of run policies
|
#### Example of run policies
|
||||||
|
|
||||||
```go
|
```go
|
||||||
r.Go(func(ctx context.Context) error {
|
r.Go(func(ctx context.Context) error {
|
||||||
// If this routine produce no error - it just restarts
|
// If this routine produce no error - it just restarts
|
||||||
// If it returns error - all other routines will shutdown (because context cancels)
|
// If it returns error - all other routines will shutdown (because context cancels)
|
||||||
}, rutina.RestartIfDone, rutina.ShutdownIfFail)
|
}, rutina.RestartIfDone, rutina.ShutdownIfFail)
|
||||||
|
|
||||||
r.Go(func(ctx context.Context) error {
|
r.Go(func(ctx context.Context) error {
|
||||||
// If this routine produce no error - it just completes
|
// If this routine produce no error - it just completes
|
||||||
// If it returns error - all other routines will shutdown (because context cancels)
|
// If it returns error - all other routines will shutdown (because context cancels)
|
||||||
}, rutina.DoNothingIfDone, rutina.ShutdownIfFail)
|
}, rutina.DoNothingIfDone, rutina.ShutdownIfFail)
|
||||||
|
|
||||||
r.Go(func(ctx context.Context) error {
|
r.Go(func(ctx context.Context) error {
|
||||||
// If this routine produce no error - all other routines will shutdown (because context cancels)
|
// If this routine produce no error - all other routines will shutdown (because context cancels)
|
||||||
// If it returns error - it will be restarted
|
// If it returns error - it will be restarted
|
||||||
}, rutina.RestartIfFail)
|
}, rutina.RestartIfFail)
|
||||||
|
|
||||||
r.Go(func(ctx context.Context) error {
|
r.Go(func(ctx context.Context) error {
|
||||||
// If this routine stopped by any case - all other routines will shutdown (because context cancels)
|
// If this routine stopped by any case - all other routines will shutdown (because context cancels)
|
||||||
}, rutina.ShutdownIfDone)
|
}, rutina.ShutdownIfDone)
|
||||||
|
|
||||||
r.ListenOsSignals() // Shutdown all routines by OS signal
|
r.ListenOsSignals() // Shutdown all routines by OS signal
|
||||||
```
|
```
|
||||||
|
|
||||||
### Wait routines to complete
|
### Wait routines to complete
|
||||||
|
|
Loading…
Reference in a new issue