This is an archive of the discontinued LLVM Phabricator instance.

[libc][rpc] Avoid leaking port in Server.h
Needs ReviewPublic

Authored by JonChesterfield on May 3 2023, 3:15 PM.

Details

Reviewers
jhuber6

Diff Detail

Event Timeline

JonChesterfield created this revision.May 3 2023, 3:15 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 3 2023, 3:15 PM
JonChesterfield requested review of this revision.May 3 2023, 3:15 PM

The original idea was to make the Port type use RAII by default, it'd require an extra branch to check if it's already been closed but that should be removed by optimizations.

I'm not totally confident on optimisation removing that branch or the associated boolean needed in port to keep it working sanely if the port is moved but maybe. I'm pretty phobic of branches on GPUs.

I'm not totally confident on optimisation removing that branch or the associated boolean needed in port to keep it working sanely if the port is moved but maybe. I'm pretty phobic of branches on GPUs.

We'd need to check the IR. I don't think there's too much utility for just having it here since there's only a single port and we close it after the switch.

Well, mostly the utility is it fixes the leak I reported weeks ago. Default: forgot to close the port. Seems plausible that other cases will want to write return instead of break and do likewise.