cURL Mailing List Monthly Index Single Mail
curl-library Mailing List Archives
Re: [PATCH] add some locking for thread-safety to NSS implementation
On Tue, Sep 16, 2008 at 03:08:07PM -0400, Rob Crittenden wrote:
> Rob Crittenden wrote:
>> Add some locking around the initialized test to make it thread-safe.
>> Make the code more aware of whether it has initialized NSS itself or
>> whether it was initialized in another library linked with libcurl.
>> We would always shut down NSS during cleanup whether we initialized or
>> or not. Now we will only shut it down if libcurl initialized it.
> Updated patch that fixes a mis-placed PR_Unlock() which could cause a hang.
There looks to me like there's still a race condition in there. If a
thread switch occurs in Curl_nss_connect() in the "Unable to initialize
NSS database" error case after the lock is cleared but before initialized
is set to 0, another thread could to sneak in and set initialized to 1
before the first thread sets it back to 0, causing the next call to
initialize NSS again. Also, initialized should be made volatile.
http://www.MoveAnnouncer.com The web change of address service
Let webmasters know that your web site has moved
Received on 2008-09-16
These mail archives are generated by hypermail.
Page updated November 12, 2010.
File upload with ASP.NET
web site info