curl-library
Re: successful multi-threaded use of libcurl
Date: Mon, 8 Oct 2001 12:23:49 -0700
Thought I'd pass along my multi-threaded experience using libcurl:
I'm using libcurl 7.8 on Red Hat Linux 6.2. I'm writing a multi-threaded
app to download urls. On my first pass, I wrote it single-threaded and
everything worked fine. Then I changed the app to do downloads in multiple
threads and I would randomly (about 1 out of 10 runs) get an immediate hard
exit from my program. After further investigation, I found the program was
exiting in the gethostbyname_r call. "./configure" found the correct
gethostbyname_r function with 6 arguments. So I removed the
HAVE_GETHOSTBYNAME_R_6 and HAVE_GETHOSTNAME_R #defines in config.h so that
the gethostbyname function would get called instead of gethostbyname_r in
hostip.c and everything seems to work fine.
I'm guessing there's a problem with a static variable or something in the
gethostname_r function, but I haven't looked at the C runtime library
source. I went to the Red Hat website and saw no mention of any problems
with the function.
Hope this helps
Keep up the good work
brad
Received on 2001-10-08