@@ -146,6 +146,10 @@ fn AsyncMachPort(comptime xev: type) type {
146146 info : * anyopaque ,
147147 count : posix.system.mach_msg_type_number_t ,
148148 ) posix.system.kern_return_t ;
149+ extern "c" fn mach_port_destroy (
150+ task : posix.system.ipc_space_t ,
151+ name : posix.system.mach_port_name_t ,
152+ ) posix.system.kern_return_t ;
149153
150154 /// The mach port
151155 port : posix.system.mach_port_name_t ,
@@ -165,7 +169,7 @@ fn AsyncMachPort(comptime xev: type) type {
165169 .SUCCESS = > {}, // Success
166170 else = > return error .MachPortAllocFailed ,
167171 }
168- errdefer _ = posix .system .mach_port_deallocate (mach_self , mach_port );
172+ errdefer _ = posix .system .mach_port_destroy (mach_self , mach_port );
169173
170174 // Insert a send right into the port since we also use this to send
171175 switch (posix .system .getKernError (posix .system .mach_port_insert_right (
@@ -200,7 +204,7 @@ fn AsyncMachPort(comptime xev: type) type {
200204 /// Clean up the async. This will forcibly deinitialize any resources
201205 /// and may result in erroneous wait callbacks to be fired.
202206 pub fn deinit (self : * Self ) void {
203- _ = posix . system . mach_port_deallocate (
207+ _ = mach_port_destroy (
204208 posix .system .mach_task_self (),
205209 self .port ,
206210 );
0 commit comments