<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#333333">
Hi, I am developing a Windows C++ application that uses OpenSSL.<br>
<br>
The application has 2 threads created by CreateThread that perform
SSL functions such as connecting to a website over HTTPS and
sending/receiving data<br>
<br>
I am already using a mutex to prevent race conditions, like this:<br>
<br>
static HANDLE sslmutex=0; // global variable at top of file<br>
<br>
<b>inside thread #1:</b><br>
while(1)<br>
{<br>
WaitForSingleObject(sslmutex,INFINITE);<br>
DoSsl();<br>
ReleaseMutex(sslmutex);<br>
Sleep(1000);<br>
}<br>
<br>
<b>inside thread #2:</b><br>
<br>
while(1)<br>
{ <br>
WaitForSingleObject(sslmutex,INFINITE);<br>
DoSsl();<br>
ReleaseMutex(sslmutex);<br>
Sleep(1000);<br>
}<br>
<br>
All SSL related code is in the DoSsl function including
SSL_library_init(), sending/receiving data, and necessary clean up
operations. <br>
<br>
Is it still necessary for me to use CRYPTO_set_locking_callback or
is my code already thread safe?<br>
<br>
Any assistance greatly appreciated.<br>
<br>
Best Regards,<br>
<br>
-Avery<br>
<br>
<br>
</body>
</html>