asynchronous socket writing

Marc Lehmann schmorp at
Fri Mar 12 10:38:17 CET 2010

On Thu, Mar 11, 2010 at 10:22:48PM +0100, "jonas at" <jonas at> wrote:
> Accept, read, process, write -- all the stuff you do when you get an HTTP request.

well, *during* accept, read, process etc. obviously you cannot accept other
requests (for that, it would have to be asynchronous :).

you have to return to the event loop (or run the event loop) for events to be
seen and acted upon.

that's what other people mean when they said that you should keep
your processing time reasonably short (or separate it into multiple
"chunks" that get called by e.g. an idle watcher) - as long as you
calculate something, your program can't do anything else. accept/read on
non-blocking file descriptions etc. are usually very quick, so most likely
your program hangs on other things, such as reading from a file (which is
not that quick as often heavy physical things have to move :), or while
calculating something.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list