"Wirta, Ville" wrote:
>
> Hi all!
>
> I'm still fighting against casual fall-downs with my server and OpenSSL. I
> found an interesting point from OpenSSL man pages that mentioned two
> important call back functions that have to be set. "locking_funktion" and
> "id_function". If I understood correctly the id one is not needed with NT or
> Linux... how about with Aix or Solaris? Is the "locking_funktion" ment to
If on aix/solaris, the getpid() function does not return the thread id
for
your thread, then you need to provide id_function which would provide
the
thread id.
> offer OpenSSL some kind of locking service? F.ex. with mutexes? If so might
> there be an example somewhere? I don't quite understand what kind the
> function should be...
>
> Thanks for any help!
>
> Yours VW
Here is what somebody provided last time this question
was raised. It works for pthreads on RHLinux 6.1
void MultiThreadSetup(void)
{
for(int i=0; i < CRYPTO_NUM_LOCKS; i++)
{
pthread_mutex_init(&cryptoLocks[i], NULL);
}
CRYPTO_set_locking_callback((void(*)(int, int, const char*, int))
LockingCallback);
}
void MultiThreadCleanup(void)
{
CRYPTO_set_locking_callback(NULL);
}
static void LockingCallback(int mode, int type, char *file, int line)
{
if(mode & CRYPTO_LOCK)
{
pthread_mutex_lock(&cryptoLocks[type]);
}
else
{
pthread_mutex_unlock(&cryptoLocks[type]);
}
}
and include following in your .h
static void LockingCallback(int mode, int type,
char *file, int line);
static pthread_mutex_t cryptoLocks[CRYPTO_NUM_LOCKS];
void MultiThreadSetup(void);
void MultiThreadCleanup(void);
Bye
Shridhar.
--------------------------------------------------------------------
Shridhar Bhat. [EMAIL PROTECTED]
PSPL,"Panini", 2A Senapati Bapat Rd.,Pune -16 Tel: 5676700 #ext 561
--------------------------------------------------------------------
Quote for the day:
Don't ask the barber whether you need a haircut or a salesman if
his is a good price
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]