[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Different behavior of my code



On 9/8/11 5:40 PM, Scott Lamb wrote:
Going back to Bernd Schoeller's original question: if "in.dat" and
"out.dat" are regular files, there's nothing useful libevent can do in
this program. If you just want to try out libevent, I'd suggest
playing with sockets instead. If you want to write your own cp that
overlaps reads and writes, I'd suggest (1) using threads, (2) aio, or
(3) mmap()ing the source file and doing a write() directly from this
memory to the destination. (The mmap() only works if your platform's
virtual memory size is sufficient for the file in question. I'd avoid
it on 32-bit platforms.)

Dear Scott and everybody else who replied to my question: Thank you very much for your insights. I must admit that I am surprised and a little sad about the fact that not all file descriptors are created equal and that select and its alternatives do not behave similar for all of them, despite the fact that they could.

What I wanted to do was to develop a general event-based IO framework for some language I am using, using libevent as a basis. Now I see that this does not work as expected, as I cannot create a uniform approach to files, sockets, pipes, etc. I have to reconsider my options and see what approach I do take from now.

Thanks again to everybody who answered.

Bernd
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.