Open Lighting Architecture
Latest Git
|
Automatically close a socket when it goes out of scope.
This class is useful if you need to temporarily open a socket and want to make sure it's cleaned up. Think of it as an auto_ptr for file descriptors.
Public Member Functions | |
SocketCloser (int fd) | |
Create a new SocketCloser. More... | |
~SocketCloser () | |
Destructor. | |
int | Release () |
Release the file descriptor. More... | |
|
inlineexplicit |
Create a new SocketCloser.
fd | the file descriptor to close. |
|
inline |
Release the file descriptor.
Calling Release prevents the file descriptor from being closed when this object goes out of scope.