kw after
Contextual keyword — select branches (§8.7)
The list of words: §1.4
Syntax
SelArm = ( "recv" Pattern "from" Expr | "send" Expr "to" Expr | "after" Expr | "else" ) "=>" Expr ;Grammar: App. A
Defined in
- 17.4 Timers and schedules — after, every, at are std.time functions with a closure as the last argument; they run in the current task until it is cancelled (for the bac
- 1.4 Keywords — Reserved (cannot be used as names)
- 8.7 Channels and select — tx.send(x) suspends when the buffer is full; cap
- 10.2 rpc attributes — Defaults for all rpcs are set in cluster { defaults { …
- 18.4 Simulation — In sim the scheduler, network, clocks, randomness and disk failures are deterministic; the result depends only on the seed.
Examples
sleep(BACKOFF)
after(RETRY_DELAY) { retry() }
every(SYNC_PERIOD) { sync() }
at(cron"0 9 * * MON-FRI".in(tz"Europe/Moscow")) { report() }let (tx, rx) = chan<Job>(cap: JOB_QUEUE)
select {
recv job from rx => process(job)
send r to results => sent += 1
after IDLE_TIMEOUT => log.info("idle")
else => tick() // non-blocking variant
}Related diagnostics
attribute-not-applicable, cache-not-readonly, invalid-window, retry-not-idempotent, rpc-attr