fix: more robust futex calls

This commit is contained in:
2024-08-27 17:07:26 +02:00
parent c898843120
commit 52b2471284

View File

@@ -92,6 +92,8 @@ export fn agent_start(reg u64 shared_mem sync_mem private_mem_fd) {
key_id = 0;
while (true) {
while {
() = #unspill(sync_mem);
futex_op = 0;
@@ -100,6 +102,7 @@ export fn agent_start(reg u64 shared_mem sync_mem private_mem_fd) {
uaddr2 = 0;
val3 = 0;
woken_up = #futex(sync_mem, futex_op, val, timeout, uaddr2, val3);
} (woken_up != 0)
() = #unspill(shared_mem, sync_mem, private_mem);
@@ -117,13 +120,14 @@ export fn agent_start(reg u64 shared_mem sync_mem private_mem_fd) {
}
}
while {
() = #unspill(sync_mem);
futex_op = 1;
val = 1;
timeout = 0;
uaddr2 = 0;
val3 = 0;
woken_up = #futex(sync_mem, futex_op, val, timeout, uaddr2, val3);
} (woken_up != 1)
}
}