louise
The Louise language: compiler, runtime, std, tooling
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#125 · main · 16 min 13 s
0Étoiles
0Forks
40Issues
| 1 | // Preemption latency (issue #191, ADR 0046 piece 2): a busy actor burns |
| 2 | // through its reduction budget, so an exit signal is delivered to it at |
| 3 | // its loop's next entry. The spin is a self tail call — exactly the |
| 4 | // entry that keeps the preemption point. With the point dropped from |
| 5 | // every entry this hangs: nothing would ever interrupt `spin`. |
| 6 | |
| 7 | import std/io |
| 8 | import std/process.{type proc, Down, Killed} |
| 9 | |
| 10 | fn spin :: n: Int -> () |
| 11 | { |
| 12 | spin (n + 1) |
| 13 | } |
| 14 | |
| 15 | pub fn main :: -> () / <io, proc> |
| 16 | { |
| 17 | let busy = process.spawn fn { spin 0 } |
| 18 | let seen = process.monitor busy |
| 19 | process.kill busy |
| 20 | let Down(_, why) = process.receive_forever seen |
| 21 | match why { Killed -> io.println "killed", _ -> io.println "other" } |
| 22 | } |
| 23 | //> killed |