13 #include <sys/timeb.h>
20 # include <winsock2.h>
23 # if defined(_MSC_VER)
28 # include <sys/time.h>
32 using namespace XmlRpc;
60 if (it->getSource() == source)
73 if (it->getSource() == source)
75 it->getMask() = eventMask;
88 _endTime = (timeout < 0.0) ? -1.0 : (timeNow + timeout);
108 for (SourceList::iterator it=closeList.begin(); it!=closeList.end(); ++it) {
126 timeout -= (t - timeNow);
157 for (SourceList::iterator it=closeList.begin(); it!=closeList.end(); ++it)
158 it->getSource()->close();
171 return ((
double) tbuff.time + ((
double)tbuff.millitm / 1000.0) +
172 ((
double) tbuff.timezone * 60));
177 gettimeofday(&tv, &tz);
178 return (tv.tv_sec + tv.tv_usec / 1000000.0);
187 #if defined(_WINDOWS) && 0
190 SourceList::iterator it;
192 int fd = it->getSource()->getfd();
194 if (it->getMask() &
ReadableEvent) mask = (FD_READ | PACKET_FD_CLOSE | FD_ACCEPT);
195 if (it->getMask() &
WritableEvent) mask |= (FD_WRITE | PACKET_FD_CLOSE);
200 fd_set inFd, outFd, excFd;
206 SourceList::iterator it;
208 int fd = it->getSource()->getfd();
211 if (it->getMask() &
Exception) FD_SET(fd, &excFd);
212 if (it->getMask() && fd > maxFd) maxFd = fd;
218 nEvents = select(maxFd+1, &inFd, &outFd, &excFd, NULL);
222 tv.tv_sec = (int)floor(timeout);
223 tv.tv_usec = ((int)floor(1000000.0 * (timeout-floor(timeout)))) % 1000000;
224 nEvents = select(maxFd+1, &inFd, &outFd, &excFd, &tv);
227 if (nEvents < 0 && errno != EINTR)
229 XmlRpcUtil::error(
"Error in XmlRpcDispatch::work: error in select (%d).", nEvents);
236 SourceList::iterator thisIt = it++;
238 int fd = src->
getfd();
242 unsigned newMask = 0;
244 if (FD_ISSET(fd, &inFd))
249 if (FD_ISSET(fd, &outFd))
254 if (FD_ISSET(fd, &excFd))
264 thisIt->getMask() = newMask;