cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: libcurl multithreading

From: Camp, TracyX E <tracyx.e.camp_at_intel.com>
Date: Fri, 22 Sep 2006 08:44:39 -0700

FYI, on win32 they have something called 'thread local storage'.

The win32 Tls functions more or less map like this:

TlsAlloc() ~ pthread_key_create()
TlsFree() ~ pthread_key_destroy()
TlsSetValue() ~ pthread_setspecific()
TlsGetValue() ~ pthread_getspecific()

I've written macros in the past that emulated the pthread calls in terms of Tls calls.

t.

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: Friday, September 22, 2006 4:37 AM
To: libcurl development
Subject: Re: libcurl multithreading

On Fri, 22 Sep 2006, Török Edvin wrote:

> However I don't understand why the suggested pthread_getspecific fix can't
> be used _if_ pthreads is available. 'pthread_getspecific' is part of POSIX
> Threads extension, and _if_ it is available, then you should add support for
> it.

Yeah, it seems logical. Although I of course will have to take your word for
it since I know very little about (p)threads in general.

I take it you have tested this approach and found it working nicely?

> What do you think of these changes below:

They seem pretty straight-forward. However:

o I want a configure switch that specificly can disable use of pthreads to
   make libcurl able to remain working as before for those who might depend on
   it or just prefer it.

o The function to check if the signal-based timeouts work would not be a new
   function but be part of curl_version_info() (the features bitmask)

o Please make it a nice diff -u patch!

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-09-22