File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
controllers/leveltriggered Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -6,17 +6,22 @@ import (
6
6
"sync"
7
7
)
8
8
9
- // This is a dead simple way to run things using a manager's context as a base, so that they will
10
- // get shut down when the manager does. It must be constructed with `newRunner`, and added to a manager:
9
+ // ctrl.Manager makes sure everything that is `Add`ed is started with a context, and cancels the context
10
+ // to signal shutdown. But: all the runnables added share the same context, so they all get shut down at
11
+ // the same time.
11
12
//
12
- // r := newRunner()
13
+ // `runner` is a dead simple way to run things with their own context, using a manager's context as a
14
+ // base, so that they will get shut down when the manager does _and_ you can shut them down individually.
15
+ // It must be constructed with `newRunner`, and added to a manager:
16
+ //
17
+ // r := newRunner(logger)
13
18
// mgr.Add(r)
14
19
//
15
20
// then you can use it to run funcs:
16
21
//
17
- // cancel := r.run(func(context.Context))
22
+ // cancel := r.run(string, func(context.Context))
18
23
//
19
- // The func will be run with its own context derived from the root context supplied by the manager,
24
+ // The func will be run with its own context, derived from the root context supplied by the manager,
20
25
// with the cancel func returned to the caller as shown. This way you can cancel the context yourself,
21
26
// or let it be canceled when the manager shuts down.
22
27
//
You can’t perform that action at this time.
0 commit comments