[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r10132 - trunk/subversion/clients/cmdline

From: Ben Reser <ben_at_reser.org>
Date: 2004-07-04 19:25:48 CEST

On Sun, Jul 04, 2004 at 01:06:53PM -0400, Greg Hudson wrote:
> I did not miss the point of the exercise. If a handled signal is
> invoked, apr_poll() will (on Unix) terminate with EINTR.

Ohhh. Didn't realize that.

> (I don't even see a separate Windows implementation of apr_poll, so
> I'm still confused as to what happens there.)

Yup, I couldn't find it either, but there's no constant to specify that
it's there. So according to APR rules it's supposed to work or return
ENOTIMPL. I'm hoping one of those is true. But until someone with
access to Windows tries, I can't say for sure...

> Your retry loop will of course catch the
> EINTR and retry, but that's not really necessary.

*nod*

> Here's a test program if you want to verify. Notice that even though
> SIGINT is handled, you can still interrupt the program with ^C.
>
> #include <apr_file_io.h>
> #include <apr_poll.h>
> #include <apr_signal.h>
>
> static apr_status_t wait_for_input(apr_file_t *f, apr_pool_t *pool)
> {
> apr_pollfd_t pollset;
> int srv, n;
>
> pollset.desc_type = APR_POLL_FILE;
> pollset.desc.f = f;
> pollset.p = pool;
> pollset.reqevents = APR_POLLIN;
>
> srv = apr_poll(&pollset, 1, &n, -1);
>
> if (n == 1 && pollset.rtnevents & APR_POLLIN)
> return APR_SUCCESS;
>
> return srv;
> }
>
> static void handler(int signum)
> {
> }
>
> int main()
> {
> apr_pool_t *pool;
> apr_file_t *file;
>
> apr_initialize();
> apr_pool_create(&pool, NULL);
> apr_file_open_stdin(&file, pool);
> apr_signal(SIGINT, handler);
> wait_for_input(file, pool);
> return 0;
> }

Okay this was very helpful...

Does that logic look right:
if (ctx)
  SVN_ERR (ctx->cancel_func (ctx->cancel_baton));
status = wait_for_input (fp, pool);
if (APR_STATUS_IS_EINTR (status))
  {
    if (ctx)
      SVN_ERR (ctx->cancel_func (ctx->cancel_baton));
    continue;
  }
else if (status && status != APR_ENOTIMPL)
  return svn_error_wrap_apr (status, _("Can't read stdin"));

-- 
Ben Reser <ben@reser.org>
http://ben.reser.org
"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jul 4 19:27:00 2004

This is an archived mail posted to the Subversion Dev mailing list.