28 #ifndef __CASINGLESOCKETGROUP__
29 #define __CASINGLESOCKETGROUP__
36 #if !defined(HAVE_POLL)&&!defined(HAVE_EPOLL)
49 #pragma warning( push )
50 #pragma warning( disable : 4127 )
52 #pragma warning( pop )
57 ti.tv_usec=time_ms*1000;
59 ret=
::select(1,NULL,&fdset,NULL,&ti);
61 ret=
::select(1,&fdset,NULL,NULL,&ti);
75 #if defined(HAVE_POLL) && !defined(HAVE_EPOLL)
81 m_pollfd=
new struct pollfd;
111 m_pollfd->events=POLLOUT;
113 m_pollfd->events=POLLIN;
119 return ::poll(m_pollfd,1,-1);
129 SINT32 ret=::poll(m_pollfd,1,time_ms);
146 struct pollfd pollfd;
148 pollfd.events=POLLOUT;
150 pollfd.events=POLLIN;
152 SINT32 ret=::poll(&pollfd,1,time_ms);
164 struct pollfd* m_pollfd;
166 #elif defined(HAVE_EPOLL)
172 m_hEPFD=epoll_create(1);
173 m_pEvents =
new struct epoll_event;
174 memset(m_pEvents, 0,
sizeof(
struct epoll_event));
192 if (epoll_ctl(m_hEPFD, EPOLL_CTL_ADD, s, m_pEvents) != 0)
205 m_pEvents->events=POLLOUT|POLLERR|POLLHUP;
207 m_pEvents->events=POLLIN|POLLERR|POLLHUP;
213 return ::epoll_wait(m_hEPFD,m_pEvents,1,-1);
218 SINT32 ret=::epoll_wait(m_hEPFD,m_pEvents,1,time_ms);
228 CAMsg::printMsg(LOG_DEBUG,
"SingleSocketGroup epoll_wait Select-Fehler: %i\n",ret);
253 struct epoll_event* m_pEvents;
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.
CASingleSocketGroup(bool bWrite)
static SINT32 select_once(CASocket &s, bool bWrite, UINT32 time_ms)
SINT32 setPoolForWrite(bool bWrite)
SOCKET getSocket()
Returns the number of the Socket used.