cURL / Mailing Lists / curl-library / Single Mail


Multi-thread initialization

From: <>
Date: Mon, 14 Jan 2013 15:03:50 +0100

Hi Daniel,


We'd like to update the cURL code to use PolarSSL v.1.2.3 and let cURL make
use of the newer and better random generation core that is included in the
PolarSSL SSL library.


Based on your existing code, you use pthreads throughout the cURL code for
ensuring thread-safety. PolarSSL functions are thread-safe as long as the
contexts are only used in a single thread at a time. The new random core
uses a 'central' entropy pool. Thus we would like to create a static
entropy_context inside polarssl.c.


Calls to that context should be thread-locked to prevent race conditions.


For that we need to initialize two mutexes for use in our mutexed entropy
functions. Where can we put the pthread_mutex_init initialization calls
inside cURL?


In our opinion the curl_global_init() function would be the best choice, but
maybe a separated file or function call is desirable.


So we like to hear your opinion on that.




List admin:
Received on 2013-01-14