flag used for actor stopping insetad of counter

This commit is contained in:
2026-02-17 17:59:12 -06:00
parent 5ee51198a7
commit b16fa75706
10 changed files with 115 additions and 109 deletions

View File

@@ -0,0 +1,20 @@
// Test: actor is suspended by fast timer and resumed under slow timer,
// completing the computation correctly.
$receiver(function(msg) {
if (msg.sum == 12499997500000) {
print("PASS: actor suspended and resumed correctly")
} else {
print(`FAIL: expected 12499997500000, got ${msg.sum}`)
}
$stop()
})
$start(function(event) {
if (event.type == 'greet') {
send(event.actor, {count: 5000000, reply: $self})
}
if (event.type == 'disrupt') {
print("FAIL: actor was killed instead of completing")
$stop()
}
}, 'tests/slow_compute_actor')

View File

@@ -0,0 +1,11 @@
// Child actor that does a slow computation and replies with the result
$receiver(function(msg) {
var n = msg.count
var sum = 0
var i = 0
while (i < n) {
sum = sum + i
i = i + 1
}
send(msg.reply, {sum: sum})
})