[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 18:47:53 CEST

On Sun, Jul 04, 2004 at 11:30:25AM -0400, Greg Hudson wrote:
> This commit seems a little rough, and it seems like an odd enough design
> that perhaps it should have been hashed out on the dev list. (Perhaps
> it was, and I missed it.)

It wasn't. The odd design is a result of APR just flat out not giving
me anyway of doing non-blocking IO on stdin without doing this. APR
actually includes code for non-blocking IO. But it will only use it on
a pipe. *sigh*

You'll note there's a comment in there saying that if and when APR gives
us better way to do this use it. Unfortunately, I don't think that'll
happen for a long time because as far as I can tell even APR 1.0 is
missing support for turning on non-blocking IO for stdin.

Incidentally this is pretty much identical to how APR does non-blocking
IO on pipes.

> On Sun, 2004-07-04 at 01:06, breser@tigris.org wrote:
> > +static apr_status_t wait_for_input_or_timeout(apr_file_t *f,
> > + apr_interval_time_t timeout,
> > + apr_pool_t *pool)
> > +{
>
> > + srv = apr_poll(&pollset, 1, &n, 10);
>
> You appear to be ignoring the timeout parameter.

Yup forgot to change that.

> > + status = wait_for_input_or_timeout(fp,10,pool);
>
> Spaces after commas?

Yup.

> > + if (status != APR_SUCCESS && status != APR_ENOTIMPL)
> > + continue;
>
> Shouldn't you be testing specifically for a timeout result? What's so
> special about APR_ENOTIMPL?

Yup you're right. The above will just loop forever on APR_ENOTIMPL or
an error.

> The timeout should really be unnecessary. Unless I'm missing something,
> apr_poll() should terminate with EINTR if a signal occurs. (On Unix,
> anyway. I don't know how this all works under Windows.)

Umm the timeout is the whole point. I'm trying to get an opportunity to
call the cancel function. I think you missed the entire point of this
exercise. If all I wanted to do was wait until someone typed something
I wouldn't need any of this at all. But I want to wait for people to
type something *AND* periodically poll for a cancel.

If someone can see a better way of achieving this then by all means
please commit it.

The fixes to your comments are committed in r10136. Thanks for catching
them.

-- 
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 18:49:45 2004

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.