Definition at line 17 of file FileDescriptor.h.
◆ FileDescriptor() [1/2]
◆ FileDescriptor() [2/2]
◆ ~FileDescriptor()
◆ close()
Definition at line 90 of file FileDescriptor.cc.
91{
92 if (m_fd > 0) {
93 if (::close(m_fd) != 0) {
94 return false;
95 }
96 }
97 m_fd = -1;
98 return true;
99}
◆ get_fd()
◆ select()
bool select |
( |
int |
sec = -1 , |
|
|
int |
usec = -1 |
|
) |
| |
Definition at line 38 of file FileDescriptor.cc.
39{
40 if (m_fd <= 0) {
41 return false;
42 }
43 fd_set fds;
44 FD_ZERO(&fds);
45 FD_SET(m_fd, &fds);
46 int ret;
47 if (sec >= 0 && usec >= 0) {
48 timeval t = {sec, usec};
49 ret = ::select(FD_SETSIZE, &fds, NULL, NULL, &t);
50 } else {
51 ret = ::select(FD_SETSIZE, &fds, NULL, NULL, NULL);
52 }
53 if (ret < 0) {
54 perror("select");
56 }
57 if (FD_ISSET(m_fd, &fds)) {
58 return true;
59 } else {
60 return false;
61 }
62}
◆ select2()
bool select2 |
( |
int |
sec = -1 , |
|
|
int |
usec = -1 |
|
) |
| |
Definition at line 64 of file FileDescriptor.cc.
65{
66 if (m_fd <= 0) {
67 return false;
68 }
69 fd_set fds;
70 FD_ZERO(&fds);
71 FD_SET(m_fd, &fds);
72 int ret;
73 if (sec >= 0 && usec >= 0) {
74 timeval t = {sec, usec};
75 ret = ::select(FD_SETSIZE, NULL, &fds, NULL, &t);
76 } else {
77 ret = ::select(FD_SETSIZE, NULL, &fds, NULL, NULL);
78 }
79 if (ret < 0) {
80 perror("select");
82 }
83 if (FD_ISSET(m_fd, &fds)) {
84 return true;
85 } else {
86 return false;
87 }
88}
◆ m_fd
The documentation for this class was generated from the following files: