
Hi Maxim, See below :)
What I might need is an event demultiplexor. Heavy loaded servers I'm working on are event driven. Each event which is not naturally a file descriptor readiness change is transformed in a socket(pair) write, so that it can be demultiplexed by epoll_wait(). Thus, an application just handles events in a loop around epoll_wait(). So, I might need a little syntactic sugar around this stuff, but I have not elaborated my generic implementation yet.
This is exactly the kind of thing a general async library would solve for you. When something is done, instead of calling send/write on a socket that exists solely to make epoll happy, just queue the C++ call (i.e., a boost::function<> object).
IMO, this contradicts with the thread title.
I was intending to make a plug for the general async library (the topic of this thread) and how it should eliminate the need for hacks to make epoll_wait do the work (basically making all async operations into I/O operations).
Non-blocking and async are not the same.
Non-blocking event model with select/poll/epoll is when you get notified when a read or write won't block. Async model with Windoze Overlapped I/O is when you get notified when a read or write has been completed. The latter is, IMO, higher level stuff and can be implemented over the former (and this is how I've been doing it in my projects).
Now we have digressed to async I/O<g>, and while I agree with your definitions, one can always implement non-blocking on top of async (maybe not as efficiently as one would like). They are just different ways to manage concurrent operations. Sadly, not all systems support both models uniformly (jab at Windows). So, what we are exploring is just how can one write a portable, asynchronous application. Clearly the application's main loop cannot be based on non-portable techniques like epoll. Not that this makes epoll or libevent bad or wrong or anything, just not general enough for all of the async needs of a portable application. Best, Don __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
participants (1)
-
Don G