11
11
Common role for schedulers. A scheduler is a piece of code that determines
12
12
which resources to use to run which task, and when.
13
13
14
- Some operations for example on L < Proc::Async|/type/Proc::Async > , L < Promise|/type/Promise > ,
15
- L < Supply|/type/Supply > allow you to specify a scheduler explicitly; they
16
- generally expect those schedulers to follow the interface defined by
17
- C < Scheduler >
14
+ Some operations for example on L < Proc::Async|/type/Proc::Async > ,
15
+ L < Promise|/type/Promise > , L < Supply|/type/Supply > allow you to specify a
16
+ scheduler explicitly; they generally expect those schedulers to follow the
17
+ interface defined by C < Scheduler > .
18
18
19
19
= head1 Methods
20
20
@@ -30,28 +30,31 @@ code that is being scheduled and run.
30
30
method cue(&code, Instant :$at, :$in, :$every, :$times = 1; :&catch --> Cancellation)
31
31
32
32
Schedules a callable (C < &code > ) for execution and returns an instantiated
33
- C < Cancellation > object to cancel the scheduling of the code for execution
34
- (which is especially important if you specify the C < every = > time> named
35
- parameter. The adverbs control when and how the code is run:
33
+ L < C < Cancellation > |/type/Cancellation > object to cancel the scheduling of the
34
+ code for execution (which is especially important if you specify the C < : every
35
+ ( time ) > named parameter) . The adverbs control when and how the code is run:
36
36
37
- C < $at > can be an L < Instant|/type/Instant > before which the code won't be run.
37
+ = item C < $at > can be an L < Instant|/type/Instant > before which the code won't be
38
+ run.
38
39
Alternatively C < $in > is the number of seconds (possibly fractional) to wait
39
40
before running the code. If C < $at > is in the past or C < $in > is negative,
40
41
the delay is treated as zero. Implementations may equate to zero
41
42
very small values (e.g. lower than 0.001s) of C < $in > or result of
42
43
C < $at > - L < now|/routine/now > .
43
44
44
- If C < $every > is specified, it is interpreted as the number of seconds
45
+ = item If C < $every > is specified, it is interpreted as the number of seconds
45
46
(possibly fractional) to wait before re-executing the code. Implementations
46
47
may treat too-small values as lowest resolution they support, possibly
47
48
warning in such situations; e.g. treating C < 0.0001 > as C < 0.001 > .
48
49
49
- C < $times > tells the scheduler how many times to run the code.
50
+ = item C < $times > tells the scheduler how many times to run the code.
50
51
51
- C < &catch > is called with the L < Exception|/type/Exception > as its sole argument
52
+ = item C < &catch > is called with the L < Exception|/type/Exception > as its sole
53
+ argument
52
54
if C < &code > dies.
53
55
54
- If C < $at > or C < $in > are C < Inf > , C < &code > will never be run; if C < $every > is
56
+ = item If C < $at > or C < $in > are C < Inf > , C < &code > will never be run; if
57
+ C < $every > is
55
58
C < Inf > , C < &code > will only be run once. If any of the three are C < -Inf > ,
56
59
C < &code > will be run immediately. If any of the three are C < NaN > , an
57
60
L < X::Scheduler::CueInNaNSeconds|/type/X::Scheduler::CueInNaNSeconds > exception
0 commit comments