diff --git a/libc/utils/gpu/loader/Server.h b/libc/utils/gpu/loader/Server.h --- a/libc/utils/gpu/loader/Server.h +++ b/libc/utils/gpu/loader/Server.h @@ -28,6 +28,13 @@ if (!port) return; + struct close { + using Port = decltype(port); + close(Port &port) : port(port) {} + ~close() { port->close(); } + Port &port; + } closer(port); + switch (port->get_opcode()) { case __llvm_libc::rpc::Opcode::PRINT_TO_STDERR: { uint64_t str_size; @@ -57,6 +64,5 @@ port->recv([](__llvm_libc::rpc::Buffer *) { /* no-op */ }); return; } - port->close(); } #endif