SASC
DVBSoftCAM

cPoller Class Reference

#include <tools.h>

List of all members.

Public Member Functions

 cPoller (int FileHandle=-1, bool Out=false)
bool Add (int FileHandle, bool Out)
bool Poll (int TimeoutMs=0)

Detailed Description

Definition at line 261 of file tools.h.


Constructor & Destructor Documentation

cPoller::cPoller ( int  FileHandle = -1,
bool  Out = false 
)

Definition at line 631 of file tools.cpp.

References Add().

{
  numFileHandles = 0;
  Add(FileHandle, Out);
}

Member Function Documentation

bool cPoller::Add ( int  FileHandle,
bool  Out 
)

Definition at line 637 of file tools.cpp.

References esyslog, fd, and i.

Referenced by cPoller().

{
  if (FileHandle >= 0) {
     for (int i = 0; i < numFileHandles; i++) {
         if (pfd[i].fd == FileHandle && pfd[i].events == (Out ? POLLOUT : POLLIN))
            return true;
         }
     if (numFileHandles < MaxPollFiles) {
        pfd[numFileHandles].fd = FileHandle;
        pfd[numFileHandles].events = Out ? POLLOUT : POLLIN;
        pfd[numFileHandles].revents = 0;
        numFileHandles++;
        return true;
        }
     esyslog("ERROR: too many file handles in cPoller");
     }
  return false;
}
bool cPoller::Poll ( int  TimeoutMs = 0)

Definition at line 656 of file tools.cpp.

Referenced by WriteAllOrNothing().

{
  if (numFileHandles) {
     if (poll(pfd, numFileHandles, TimeoutMs) != 0)
        return true; // returns true even in case of an error, to let the caller
                     // access the file and thus see the error code
     }
  return false;
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines