Giter Site home page Giter Site logo

Comments (13)

cpq avatar cpq commented on August 20, 2024

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.

cpq avatar cpq commented on August 20, 2024

We can grab the implementation for windows from
https://github.com/cesanta/mongoose/blob/3.8/mongoose.c#L1231

from fossa.

mkmik avatar mkmik commented on August 20, 2024

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.

cpq avatar cpq commented on August 20, 2024

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.

mkmik avatar mkmik commented on August 20, 2024

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.

cpq avatar cpq commented on August 20, 2024

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.

mkmik avatar mkmik commented on August 20, 2024

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.

pujo avatar pujo commented on August 20, 2024

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.

cpq avatar cpq commented on August 20, 2024

Thanks @pujo .
Note that WSAPoll is present only in recent runtime DLLs, starting from Vista. Older windows runtimes do not have it.

from fossa.

pujo avatar pujo commented on August 20, 2024

Yes, true, but I think it's not worth to support XP or older Windows.

from fossa.

cpq avatar cpq commented on August 20, 2024

Rojer, please take this over.
Consider abstracting polling API and make it easy to use different multiplexing methods, like poll, epoll, kqueue.

from fossa.

schmurfy avatar schmurfy commented on August 20, 2024

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.

rojer avatar rojer commented on August 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.