I am confused about this... in other discussion threads it is stated pretty clearly that a reader and writer thread cannot both be active at the same time. So, when we talk about "enabling thread safety" here, what does that mean? If "thread safety" is enabled like this, can a reader and write proceed concurrently? Thanks, --john
JoelKatz wrote: > > >> I'm running this on a Win32 platform, so I'm going to have to convert >> from pthreads to Win32 speak, but I think I can do that. Any gotchas >> will be appreciated though. For example, do I need the Win32 keyword >> CALLBACK or EXPORT in the function prototypes? > > No, you do not have to. > >> I'm also wondering if there is someway I can test this to make sure this >> is working correctly? > > If your application doesn't crash, ... > >> static unsigned long id_function(void) >> { >> return ((unsigned long) pthread_self()); >> } > > This is not technically legal. The results of casting a 'pthread_t' to > an > 'unsigned long' are undefined and there is no guarantee that this will > always return the same value for the same thread. (That's why > 'pthread_equal' exists.) > > To do this correctly under pthreads, you have to use TLS, storing a > unique > 'unsigned long' for each thread and assigning them yourself. > >> RAND_load_file("/dev/urandom", 1024); > > Obviously, this only makes sense on a platform that has a > '/dev/urandom'. > For Win32, you can use CryptGetDefaultProvider, CryptAcquireContext, > CryptGenRandom, then finally CryptReleaseContext. > > DS > > > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-users@openssl.org > Automated List Manager majord...@openssl.org > > -- View this message in context: http://old.nabble.com/When-to-use-CRYPTO_set_locking_callback%28%29-and-CRYPTO_set_id_callback%28%29--tp5849882p34483805.html Sent from the OpenSSL - User mailing list archive at Nabble.com. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org