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