Re: always poll, even without poll(2)
"Frediano Ziglio" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
>> >> Mmmm... I would put fakepoll.h in include/replacements directory. Also >> there is similar function named tds_REPLACED so perhaps it would be >> better to call this function tds_poll for coherence. Also for >> coherence in include/replacements.h I used defines like >> >> #define poll(a,b,c) tds_poll(a,b,c) >> >> if poll is not defined. You could include >> include/replacements/fakepoll.h in include/replacements.h or just >> include <replacements/fakepoll.h> when used. > > Will do. > > I think this is wrong, though: > >> Sat Dec 20 20:11:46 CET 2008 >> * src/replacements/fakepoll.c: >> fix win32 portability issue > > http://msdn.microsoft.com/en-us/library/ms740141(VS.85).aspx > > Microsoft says they *ignore* nfds (parameter 1 of select(2)). So it's OK > to pass any value to Win32's select() function. > > More important, we should check against FD_SETSIZE even on Win32: > > "The variable FD_SETSIZE determines the maximum number of descriptors in > a set. (The default value of FD_SETSIZE is 64, which can be modified by > defining FD_SETSIZE to another value before including Winsock2.h.)" > > but the count, not the maxfd, is what matters. > > I updated fakepoll.c according to that theory. I left in the maxfd > computation because preprocessor directives make code hard to read and > understand. The fewer we have, the better, even if it means a few extra > cycles. > Agree. In our case we never obey 64 limit but feel free to commit. freddy77