8#include "daq/slc/system/FileDescriptor.h"
10#include <daq/slc/base/IOException.h>
13#include <sys/select.h>
18FileDescriptor::FileDescriptor()
23FileDescriptor::FileDescriptor(
int fd)
28FileDescriptor::~FileDescriptor()
33int FileDescriptor::get_fd()
const
38bool FileDescriptor::select(
int sec,
int usec)
47 if (sec >= 0 && usec >= 0) {
48 timeval t = {sec, usec};
49 ret = ::select(FD_SETSIZE, &fds, NULL, NULL, &t);
51 ret = ::select(FD_SETSIZE, &fds, NULL, NULL, NULL);
57 if (FD_ISSET(m_fd, &fds)) {
64bool FileDescriptor::select2(
int sec,
int usec)
73 if (sec >= 0 && usec >= 0) {
74 timeval t = {sec, usec};
75 ret = ::select(FD_SETSIZE, NULL, &fds, NULL, &t);
77 ret = ::select(FD_SETSIZE, NULL, &fds, NULL, NULL);
83 if (FD_ISSET(m_fd, &fds)) {
90bool FileDescriptor::close()
93 if (::close(m_fd) != 0) {
Abstract base class for different kinds of events.