Thanks William, you tell me (and help me) a lot. So looks I will output the trace to a socket port and create a receiver to write it to disk.
Cheers, Arthur On 10/9/07, William Ahern <[EMAIL PROTECTED]> wrote: > > On Tue, Oct 09, 2007 at 11:06:21AM -0400, arthur zhang wrote: > > Hi All, > > > > As my understanding, with libevent, any io should be non_blocking, and > here > > comes my dumb q;-) > > > > I want log stuffs(trace) to a disk file in my comm callback, so I open a > > file like below, but I didn't get any write event to call back. I am > using > > Ubuntu Dapper and my target system is Solaris 10. > > 1) You can't do non-blocking file I/O in Unix using the standard > interfaces. > You need to use a horrible and poorly implemented interfaces like POSIX > Asynchronous I/O, which is impossible to use with libevent. > > 2) A file descriptor (to a realfile) will _always_ poll as ready for > reading > or writing. (The logic being, even though the disk might be slow, it's > still always available for I/O--the disk is one gigantic buffer.) Thus, > if your code was written properly your complaint should have been that > you got an endless succession of write readiness callbacks suspicously > lacking any gap. > > > Using stdout worked. > > If stdout was a pipe, then it would work. Thus, you could shamefully (but > with good reason) pipe to cat, and redirect cat's stdout to a file. >
_______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users