CMS 3D CMS Logo

IOSelectSig.h

Go to the documentation of this file.
00001 #ifndef CLASSLIB_IOSELECT_SIG_H
00002 # define CLASSLIB_IOSELECT_SIG_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "IOSelectPoll.h"
00007 # if HAVE_POSIX_RT_SIGNALS && HAVE_F_SETSIG
00008 #  include <sys/time.h>
00009 #  include <sys/types.h>
00010 #  include <unistd.h>
00011 #  include <signal.h>
00012 #  include <errno.h>
00013 #  include <fcntl.h>
00014 
00015 namespace lat {
00016 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00017 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00018 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00019 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00020 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00021 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00022 
00048 class IOSelectSig : public IOSelectMethod
00049 {
00050 public:
00051     IOSelectSig (void);
00052     ~IOSelectSig (void);
00053 
00054     virtual void        setSignal (int sig);
00055 
00056     // Attaching and detaching descriptors
00057     virtual void        attach    (const IOSelectRequest &req);
00058     virtual void        detach    (const IOSelectRequest &req);
00059     virtual void        clear     (void);
00060 
00061     // Descriptor listening states
00062     virtual void        setMask   (IOFD fd, unsigned value);
00063     virtual void        andMask   (IOFD fd, unsigned value);
00064     virtual void        orMask    (IOFD fd, unsigned value);
00065 
00066     // Selection
00067     virtual bool        wait      (long msecs);
00068     virtual IOFD        next      (IOSelectEvent &event, IOSelectCB &cb);
00069 
00070 private:
00071     static const int UNUSED   = -2;
00072     static const int UNLINKED = -1;
00073 
00074     void                addReady    (IOFD fd);
00075     void                delReady    (IOFD fd);
00076     void                updateReady (IOFD fd);
00077 
00079     struct item {
00085         IOFD            m_next;
00086 
00092         IOFD            m_prev;
00093 
00095         unsigned        m_mask;
00096 
00098         unsigned        m_ready;
00099 
00101         size_t          m_index;
00102     };
00103 
00104     IOSelectPoll        *m_fallback;            //< Fallback poller.
00105     int                 m_signal;               //< Signal number.
00106     sigset_t            m_sigset;               //< Signal set.
00107     IOFD                m_readylist;            //< Index of first fd ready.
00108     size_t              m_nready;               //< Number of ready fds.
00109     size_t              m_nfds;                 //< Nr of fds in use in m_fds.
00110     std::vector<item>   m_fds;                  //< Per file descriptor data.
00111 };
00112 
00113 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00114 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00115 
00116 } // namespace lat
00117 # endif // HAVE_POSIX_RT_SIGNALS && HAVE_F_SETSIG
00118 #endif // CLASSLIB_IOSELECT_SIG_H

Generated on Tue Jun 9 17:39:00 2009 for CMSSW by  doxygen 1.5.4