Implicit close for I/O objects, revisited

There was some discussion and an issue item about lacking an explicit close method on file and socket objects, and the problems with calling the OS close function implicitly in those objects’ destructors. While a somewhat lackluster and OS-specific solution for explicit closing was provided with IntoRawFd, the destructor still calls close ignoring possible errors. This makes error-ignorant usage the most convenient to write. Furthermore, this may cause the thread to block, possibly on unwind, which, as I have just discovered, is contrary to the emergent API guidelines.

Are there some future developments envisioned to deal with this problem within the standard library?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.