aboutsummaryrefslogtreecommitdiff
path: root/tests/threads/regression/recycle.zc
blob: 4f0454ace07447bfcb6bd14a9bca2d7e3d67cc49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
namespace;
include rt;
unchecked fn main() {
 int i = 0, total = 0;
 while (i < 12) {
  int fd = 0;
  let context = rt.syscall(51, fn() { int value = i; rt.syscall(44, fd, &value, 1); return 0; } as word, &fd, 0);
  int result = 0; rt.syscall(45, fd, &result, 1); total += result; rt.syscall(52, context, 0, 0); i++;
 }
 rt.put_n(total); rt.put_c(10); return 0;
}