Opened 18 years ago
Closed 18 years ago
#1589 closed defect (invalid)
Thread safe support for initialization of libcurl
Reported by: | unicoletti | Owned by: | mapserverbugs |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | WMS Client | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: | sgillies@… |
Description
The initialization of libcurl in mshttp.c is subject to a possible race condition. The patch attached attempts to solve this problem by putting a lock around it. I am adding Sean as a cc because I see he is the mantainer of the thread safe faq entry on the web site.
Attachments (1)
Change History (4)
by , 18 years ago
Attachment: | curl-ts.patch added |
---|
comment:2 by , 18 years ago
Checked out latest cvs version of mapserver and I have seen that curl initialization has already been locked, so applying this patch is not necessary. On a side note IMHO comparing mapserver code and mine I believe that my code would be cleaner. My code would be as follows: // Acquiring thread lock to prevent double initialization. // unicoletti@prometeo.it, Dec 2005 int returnCode = MS_SUCCESS; msAcquireLock( TLOCK_CURL ); if (!gbCurlInitialized && curl_global_init(CURL_GLOBAL_ALL) != 0) { msSetError(MS_HTTPERR, "Libcurl initialization failed.", "msHTTPInit()"); returnCode = MS_FAILURE; } else { gbCurlInitialized = MS_TRUE; } msReleaseLock( TLOCK_CURL ); return returnCode;
Note:
See TracTickets
for help on using tickets.
Patch to safely lock libcurl while initializing