From 81941f91611adb33796b846f492f1073b4ab9d31 Mon Sep 17 00:00:00 2001 From: Andrea Orru Date: Fri, 16 Mar 2018 01:41:45 -0700 Subject: [PATCH] Add Thread option for Mailboxes --- std/os/zen.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/std/os/zen.zig b/std/os/zen.zig index 37c674c9e1..814ec36884 100644 --- a/std/os/zen.zig +++ b/std/os/zen.zig @@ -28,7 +28,7 @@ pub const MailboxId = union(enum) { This, Kernel, Port: u16, - //Thread: u16, + Thread: u16, }; @@ -96,8 +96,11 @@ pub fn exit(status: i32) noreturn { unreachable; } -pub fn createPort(id: u16) void { - _ = syscall1(Syscall.createPort, id); +pub fn createPort(mailbox_id: &const MailboxId) void { + _ = switch (*mailbox_id) { + MailboxId.Port => |id| syscall1(Syscall.createPort, id), + else => unreachable, + }; } pub fn send(message: &const Message) void {