[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] [libevent-usr] When is a [regular file descriptor] readable or writable?
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 majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.