Hi, Adrian, Thanks for your reply. However, what you said makes me more confused:( You mean the mechanism behind libevent like epoll doesn't support regular file descriptor? I'm not sure whether you're right, but looking into the application sample given by the libevent official website, http://monkey.org/~provos/libevent/event-test.c, I found this sample using libevent on the local file 'event.fifo', and this is where my confusion came from, so I guess I must further my reading to find more proof:)
Thanks again Harvey 2011/8/3 Adrian Chadd <adr...@creative.net.au> > That's because it doesn't work that way for file backed file descriptors. > > There's no way to know a file is or isn't ready for writing, unless you had > some way of defining (say) how much data is in the write buffer for that > FD. > Linux/FreeBSD at least don't supply this to you. > > Similarly, there's no way to know a file is or isn't ready for reading, > unless > you had some way to tell the OS to begin "prefetching" for you, and only > signify to you there was file IO ready when some had been read. > > So no, it doesn't work for disk files. > > > Adrian > > On Wed, Aug 03, 2011, zhihua che wrote: > > Hi, everyone, > > > > I'm reading libevent-2.0 code and have made certain progress:). > However, > > I'm still confused with some basic concepts like "ready" for reading or > > writing. In the context of sockets, I think I can imagine this "ready" > > situation: the socket is ready for reading when the receiving buffer > > receives some data from the lower level of the network stack, and is > ready > > for writing when the sending buffer has enough free space to accept data > > from the higher level. > > My point here is how it works in terms of regular file, like local > disk > > regular file. Imagine I was monitoring a local regular file descriptor. I > > can't figure out what actions or conditions can cause the descriptor > > readable or writable. > > > > Thanks for your reply > > harvey > > -- > - Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid > Support - > - $24/pm+GST entry-level VPSes w/ capped bandwidth charges available in WA > - > *********************************************************************** > To unsubscribe, send an e-mail to majord...@freehaven.net with > unsubscribe libevent-users in the body. >