In message <[EMAIL PROTECTED]> on Fri, 07 Jun 2002 14:03:51 
-0700, Brian Doyle <[EMAIL PROTECTED]> said:

brian> The man page also says that CRYPTO_READ and CRYPTO_WRITE are
brian> mutually exclusive.  I'm confused on this and need some
brian> clarification.

Quite simple.  When some thread is writing at some position, you
probably don't want any thread else to try to read that position,
because the data there will most probably not be very consistent
(think incomplete writes).  When some thread is reading at some
position, you don't want any other thread to change that same data at
the same time.

Now, it would look like read and write locks really perform exactly
the same function, and only one type of lock would be required.
However, if you think about it, you can have several threads reading
at the same position, while it would be unwise to have several threads
write at the same place at the same time.

The conclusion becomes that read locks excludes locking for write,
while write locks exclude locking for read as well as for write.

Does that make sense to you?

-- 
Richard Levitte   \ Spannvägen 38, II \ [EMAIL PROTECTED]
Redakteur@Stacken  \ S-168 35  BROMMA  \ T: +46-8-26 52 47
                    \      SWEDEN       \ or +46-708-26 53 44
Procurator Odiosus Ex Infernis                -- [EMAIL PROTECTED]
Member of the OpenSSL development team: http://www.openssl.org/

Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to