cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: timeouts and multithreading

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 24 Sep 2001 08:38:47 +0200 (MET DST)

On Fri, 21 Sep 2001, Lucas Adamski wrote:

> After digging around into multithreading stuff, I came across ZThreads,
> which is a C++ lib (unfortunately I guess) for solves a lot of these
> problems in a multithreaded environment, as it provides abstractions such
> as queues and pipes.

As libcurl is a somewhat "lowlevel" library, I hesitate a lot before I would
make libcurl depend on a 3rd party library. Also, libcurl runs on _very_
many and diverse platforms which put a great demand on the library in
question. C++ is also out of the question, libcurl is C.

> A simpler solution for just the pipe is just to wrap it in a mutex, but
> that may in fact end up slowing things down if you run a program with a
> lot of threads, if a lot of them are stuck waiting for the mutex versus
> doing their own lookups?

No, a mutex wouldn't solve this issue. We need a good way (read: without the
use of signals) to be able to stop a name resolving function at any given
time, a mutex does not help.

The name lookup needs to run in a separate process/thread for this to work.
This requires platform-specific implementations.

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