On Mon, Jul 09, 2001 at 10:34:52PM +0200, Bodo Moeller wrote:

[...]
>>     would be written like this...
>>         
>>         CRYPTO_w_lock(CRYPTO_LOCK_RAND);
>> 
>>         locking_thread = CRYPTO_thread_id();
>>         crypto_lock_rand = 1;

> This was also my guess when reading your above problem description.
> Hopefully this is a sign that this time it is really correct.
> 
> Actually it can not be correct if access to 'unsigned long' values is
> not atomic.  If I decide to be that pedantic (and I start to feel I
> should), I have to introduce an additional lock for protecting access
> to 'locking_thread'.  This does not add significant overhead as
> this is only needed on the few occasions when 'crypto_lock_rand' is
> set.

That last sentence is wrong: It is correct as far as *reading*
'locking_thread' is concerned, but much more often that variable has
to be *written*.  Oh well.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to