Commit ce27fd77 authored by Kenton Varda's avatar Kenton Varda

Tweak: Remove redundant UnwindDetector from AutoCloseFd.

This is redundant as the destructor already uses a recoverable assertion, which will not throw during unwind.

I have long assumed AutoCloseFd wrapped only an integer and was shocked to realize it was more that that...
parent 0067a542
...@@ -326,14 +326,13 @@ void VectorOutputStream::grow(size_t minSize) { ...@@ -326,14 +326,13 @@ void VectorOutputStream::grow(size_t minSize) {
AutoCloseFd::~AutoCloseFd() noexcept(false) { AutoCloseFd::~AutoCloseFd() noexcept(false) {
if (fd >= 0) { if (fd >= 0) {
unwindDetector.catchExceptionsIfUnwinding([&]() { // Don't use SYSCALL() here because close() should not be repeated on EINTR.
// Don't use SYSCALL() here because close() should not be repeated on EINTR. if (miniposix::close(fd) < 0) {
if (miniposix::close(fd) < 0) { KJ_FAIL_SYSCALL("close", errno, fd) {
KJ_FAIL_SYSCALL("close", errno, fd) { // This ensures we don't throw an exception if unwinding.
break; break;
}
} }
}); }
} }
} }
......
...@@ -300,7 +300,6 @@ public: ...@@ -300,7 +300,6 @@ public:
private: private:
int fd; int fd;
UnwindDetector unwindDetector;
}; };
inline auto KJ_STRINGIFY(const AutoCloseFd& fd) inline auto KJ_STRINGIFY(const AutoCloseFd& fd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment