[Ace-users] [ace-users] ACE_SOCK_Stream::recv_n() returns -1 if interrupted by signal

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Fri Oct 26 14:42:18 CDT 2007


Hi Jules,

> No, that won't work.  The signal needs to be delivered, to the thread
> that does the read, in a timely manner.  It can't be blocked.

Ok, that rules out that approach, though it's not clear why you're doing
things like this since what's the point of having the read thread
interrupted by the signal handler vs. some other thread?

> How about providing a new function, or a flag to modify the behaviour
> of one of the existing functions?

Right, that's "Plan B".  If you check out ACE_SOCK_Acceptor::accept()
you'll see one way to do this:

  /**
   * Accept a new ACE_SOCK_Stream connection.  A @a timeout of 0
   * means block forever, a @a timeout of {0, 0} means poll.  <restart>
   * == 1 means "restart if interrupted," i.e., if errno == EINTR.
   * Note that @a new_stream inherits the "blocking mode" of @c this
   * ACE_SOCK_Acceptor, i.e., if @c this acceptor factory is in
   * non-blocking mode, the @a new_stream will be in non-blocking mode
   * and vice versa.
   */
  int accept (ACE_SOCK_Stream &new_stream,
              ACE_Addr *remote_addr = 0,
              ACE_Time_Value *timeout = 0,
              int restart = 1,
              int reset_new_handle = 0) const;

Something similar could be added to ACE_SOCK_Stream::recv_n().  If you'd
like to do this and send us the patches relative to the version that's
in the SVN HEAD branch that would be great!

Thanks very much,
       
       Doug



More information about the Ace-users mailing list