MCPcopy Create free account
hub / github.com/DeNA/HandlerSocket-Plugin-for-MySQL / auto_file

Class auto_file

libhsclient/auto_file.hpp:21–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19namespace dena {
20
21struct auto_file : private noncopyable {
22 auto_file() : fd(-1) { }
23 ~auto_file() {
24 reset();
25 }
26 int get() const { return fd; }
27 int close() {
28 if (fd < 0) {
29 return 0;
30 }
31 const int r = ::close(fd);
32 fd = -1;
33 return r;
34 }
35 void reset(int x = -1) {
36 if (fd >= 0) {
37 this->close();
38 }
39 fd = x;
40 }
41 private:
42 int fd;
43};
44
45struct auto_dir : private noncopyable {
46 auto_dir() : dp(0) { }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected