File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
1
use v6 ;
2
2
use Test ;
3
3
4
- plan 15 ;
4
+ plan 18 ;
5
5
6
6
# real scheduling here
7
7
my $ name = $ * SCHEDULER .^ name ;
@@ -18,6 +18,23 @@ my $name = $*SCHEDULER.^name;
18
18
LEAVE $ c . cancel;
19
19
}
20
20
21
+ {
22
+ # Also at risk of being a little fragile, but again hopefully OK on all
23
+ # but the most ridiculously loaded systems.
24
+ my $ a = 0 ;
25
+ my $ stop ;
26
+ my $ c = $ * SCHEDULER . cue({ cas $ a , {. succ } }, : every(0.1 ), : stop({$ stop }));
27
+ isa_ok $ c , Cancellation;
28
+ sleep 1 ;
29
+ $ stop = True ;
30
+
31
+ diag " seen $ a runs" if !
32
+ ok 5 < $ a < 15 , " Cue with :every :stop schedules repeatedly" ;
33
+ my $ seen = $ a ;
34
+ diag " seen { $ a - $ seen } runs after stop" if !
35
+ ok $ seen <= $ a <= $ seen + 1 , " Cue with :every :stop stops scheduling" ;
36
+ }
37
+
21
38
{
22
39
# Also at risk of being a little fragile, but again hopefully Ok on all
23
40
# but the most ridiculously loaded systems.
You can’t perform that action at this time.
0 commit comments