Comments (13)
My thinking is that poll()
exists on all unix-like systems.
for windows and friends, we can just implement poll()
using, say, select()
.
So I guess we should just blatantly replace select code with poll code.
from fossa.
We can grab the implementation for windows from
https://github.com/cesanta/mongoose/blob/3.8/mongoose.c#L1231
from fossa.
poll() conforms to POSIX.1-2001.
Man page on OSX (afaik since 10.5) says:
The poll() system call currently does not support devices.
I guess that this might be a problem for people adding arbitrary FDs, e.g. serial ports on mac. We should have let the user choose which impl, via preprocessor define, and have the select
based impl be selected by default on windows.
Later we can also implement kqueue on osx/freebsd and epoll on linux which afaik doesn't have this problem and offers better performance.
from fossa.
That's surprising that poll does not support any FD.
Okay.
If we go preprocessor way, then I see no point in implementing poll for linuks.
Shall we go with epoll()
straight away?
from fossa.
It's just a bug. See also a python bug report about the same issue:
http://bugs.python.org/issue5154
From there it seems that kqueue is also affected by the same thing.
I don't think we should care too much, as long as we allow the user to force select
fallback (since we'll already provide it for windows). Software using fossa on osx/linux will be mostly for networking and when not, it's probably for development.
from fossa.
Ok.
I mean, there is little value in adding poll()
mechanism, cause it's as slow as select - we should invest in epoll()
instead.
from fossa.
I think it's worth to implement epoll
/kqueue
and fallback to select, unless there are some interesting platforms which do implement poll
but not epoll
/kqueue
. In that case the advantage of poll
over select
would be just the maximum number of FDs.
from fossa.
On Windows OS we have the WSAPoll
API function available.
I used it in previous Mongoose implementations working perfectly.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms741669
from fossa.
Thanks @pujo .
Note that WSAPoll is present only in recent runtime DLLs, starting from Vista. Older windows runtimes do not have it.
from fossa.
Yes, true, but I think it's not worth to support XP or older Windows.
from fossa.
Rojer, please take this over.
Consider abstracting polling API and make it easy to use different multiplexing methods, like poll, epoll, kqueue.
from fossa.
I might be completely wrong on that but from my understanding select is more eficient for small number of descriptors and after certain threshold epool/kqueue take the lead. If that is the case select might be more appropriate in the use case I would use this library (small embedded systems won't handle thousands of connections).
from fossa.
poll() is cumbersome. 3a54681 added support for epoll on linux, and refactoring has been done to make adding support for other mechanisms easier.
from fossa.
Related Issues (20)
- Debugging information error HOT 1
- JSON RPC responses are limited in size by size of pre-defined buffer HOT 6
- Actually, C allows implicit conversion HOT 2
- Current Cipher-suite is not supported on latest Firefox (ssl_error_no_cypher_overlap) HOT 5
- SSL REST client: calling SSL_accept() during handshake HOT 4
- with DISABLE_FILESYSTEM, no default ns server is provided. HOT 15
- Make fossa friendlier for embedded systems HOT 4
- Add support work with other ssl libs in fossa HOT 1
- handle_chunked buffer overflow. HOT 1
- http_client hangup on receive data HOT 2
- error build (ubuntu 10.04)
- missing .gitgnore
- Fossa fails to link without NS_DISABLE_PFS switch on Windows HOT 6
- latest code complain over random() on windows HOT 2
- wrong example, restful_server HOT 1
- Aborted (core dumped) HOT 9
- VC++ 2015 int strnlen HOT 1
- VC++2015 error C4996: 'fileno' HOT 1
- VC++ 2015 struct ns_mgr dummy = {}; HOT 1
- Undefined behaviour under Release build
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fossa.