On Mon, Mar 5, 2012 at 1:39 PM, Costin Manolache <cos...@gmail.com> wrote:
> > > On Mon, Mar 5, 2012 at 4:45 AM, Mladen Turk <mt...@apache.org> wrote: > >> On 03/05/2012 07:30 AM, cos...@apache.org wrote: >> >>> Author: costin >>> Date: Mon Mar 5 06:30:17 2012 >>> New Revision: 1296944 >>> >>> URL: >>> http://svn.apache.org/viewvc?**rev=1296944&view=rev<http://svn.apache.org/viewvc?rev=1296944&view=rev> >>> Log: >>> EINTR needs to be returned to java in order for Poll.interrupt() to >>> work, it is already handled in AprEndpoint. >>> >> >> Not sure if that's correct. >> EINTR is transient signal and doesn't mean that the actual event was >> fired. >> Any function that waits on some event should restart the operation if >> EINTR >> was signalled. See 'man poll' >> >> If interrupt doesn't work its something else to blame, not EINTR. >> > > If interrupt() is called, EINTR is generated as result to poll - confirmed > with printfs(). > Without this change - poll is not interrupted. I spent quite a bit of time > debugging it. > > It is true EINTR is 'transient signal' and may be generated without an > event fired - that's what > interrupt is supposed to do after all, and it's possible other events > cause it. > > I see no harm in returning this to the java stack - the AprEndpoint is > expecting it along with timeup. > > A better explanation: apr/poll/unix/poll.c: /* Check if the polled descriptor is our * wakeup pipe. In that case do not put it result set. */ if ((pollset->flags & APR_POLLSET_WAKEABLE) && pollset->p->query_set[i].desc_type == APR_POLL_FILE && pollset->p->query_set[i].desc.f == pollset->wakeup_pipe[0]) { apr_pollset_drain_wakeup_pipe(pollset); rv = APR_EINTR; } (interrupt() calls poll_wakepup which writes to the wakeup_pipe ). Costin