diff options
Diffstat (limited to 'tests/threads/accept/isolation.zc')
| -rw-r--r-- | tests/threads/accept/isolation.zc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/threads/accept/isolation.zc b/tests/threads/accept/isolation.zc new file mode 100644 index 0000000..cb1a5e7 --- /dev/null +++ b/tests/threads/accept/isolation.zc @@ -0,0 +1,17 @@ +namespace; +include rt; +int global_state = 16; +unchecked fn main() { + int fd = 0, state = 7; word heap = rt.new(1); heap[0] = 4; + let parent_process = rt.syscall(53, 0, 0, 0), parent_thread = rt.syscall(54, 0, 0, 0); + let callback = fn() { + global_state += 5; state += 9; heap[0] += 3; + int reply[5]; reply[0] = global_state; reply[1] = state; reply[2] = heap[0]; reply[3] = rt.syscall(53, 0, 0, 0); reply[4] = rt.syscall(54, 0, 0, 0); + rt.syscall(44, fd, reply, 5); return 0; + }; + let context = rt.syscall(51, callback as word, &fd, 0); + int result[5]; rt.syscall(45, fd, result, 5); rt.syscall(52, context, 0, 0); + rt.put_n(result[0]); rt.put_c(' '); rt.put_n(result[1]); rt.put_c(' '); rt.put_n(result[2]); rt.put_c(' '); + rt.put_n(global_state); rt.put_c(' '); rt.put_n(state); rt.put_c(' '); rt.put_n(heap[0]); rt.put_c(' '); + rt.put_n(result[3] == parent_process); rt.put_c(' '); rt.put_n(result[4] != parent_thread); rt.put_c(10); return 0; +} |
