On Jan 10, 2011, at 2:03 PM, Ben Noordhuis wrote:

> On Mon, Jan 10, 2011 at 22:22, Neil McKee <neil.mc...@inmon.com> wrote:
>> I pushed changes to:
>> 
>> 1.  use PIPE_BUF from limits.h (if available).
>> 2.  use apr_file_pipe_timeout_set(<pipe>, 0) on both ends -- just to make 
>> absolutely certain that the writes from the critical section are always 
>> non-blocking.
>> 3.  use apr_poll() at the read end of the pipe to get my read timeout back.
>> 4.  make sure any critical-section logging is with APLOG_DEBUG.
>> 
>> http://code.google.com/p/mod-sflow/source/browse/trunk/mod_sflow.c?r=17
> 
> Much better, Neil.
> 
>> setting the "timeout" to 0 seems to be equivalent to setting O_NONBLOCK?
> 
> Even better, apr_file_pipe_timeout_set() with timeout > -1 sets O_NONBLOCK.
> 

I think I understand now.  I can have:

apr_file_pipe_timeout_set(<read_end>,  900000);
apr_file_pipe_timeout_set(<write_end>, 0);

and remove all that apr_poll() code again:
http://code.google.com/p/mod-sflow/source/browse/trunk/mod_sflow.c?r=20

Thanks!

Neil


>> I don't see any functions for assembling an apr_pollfd_t object
> 
> There indeed aren't, creating them by hand is the (only) way to go.


Reply via email to