cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: timeouts and multithreading

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 20 Sep 2001 09:41:26 +0200 (MET DST)

On Wed, 19 Sep 2001, Lucas Adamski wrote:

> I've made decent progress on my little C++ libcurl project, however I
> haven't had much luck figuring out a way to get timeouts to work. I was
> going to try taking the tact of killing threads that exceed a certain
> time limit, but apparently that's considered a Bad Idea.

In general, yes.

> I wouldn't mind changing the connect timeouts in the Solaris source code,
> however I don't have access to a sun compiler to rebuild. Even then it
> wouldn't solve other potential problems such as hung sockets, etc. Has
> anyone gotten over this problem yet?

The timeouts are only signal-based for operations that are truely slow and
synchronous (and happen before any actual transfer takes place). In a
"normal" operation, that is the name resolving and socket connect call.

Once the connect is passed, no signals are used to deal with the timeout.
Only select().

The connection should be rewritten to use non-blocking connect to avoid the
need for signals.

The name resolving could be rewritten using an asynchronous name resolver
that would be possible to abort without signals. This would take some effort
to make it work neatly on many platforms.

--
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-09-20