Hi darry:
Thank you very much for your reply.
I was looking for some help to resolve the crash issue.
I have copied the callback from mttest.c file as below:
static pthread_mutex_t *lock_cs;
static long *lock_count;
void thread_setup(void)
{
int i;
lock_cs=OPENSSL_malloc(CRYPTO_num_locks() *
sizeof(pthread_mutex_t));
lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
for (i=0; i<CRYPTO_num_locks(); i++)
{
lock_count[i]=0;
pthread_mutex_init(&(lock_cs[i]),NULL);
}
CRYPTO_set_id_callback((unsigned long (*)())pthreads_thread_id);
CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback);
}
void thread_cleanup(void)
{
int i;
CRYPTO_set_locking_callback(NULL);
fprintf(stderr,"cleanup\n");
for (i=0; i<CRYPTO_num_locks(); i++)
{
pthread_mutex_destroy(&(lock_cs[i]));
fprintf(stderr,"%8ld:%s\n",lock_count[i],
CRYPTO_get_lock_name(i));
}
OPENSSL_free(lock_cs);
OPENSSL_free(lock_count);
fprintf(stderr,"done cleanup\n");
}
void pthreads_locking_callback(int mode, int type, char *file,
int line)
{
#ifdef undef
fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
CRYPTO_thread_id(),
(mode&CRYPTO_LOCK)?"l":"u",
(type&CRYPTO_READ)?"r":"w",file,line);
#endif
/*
if (CRYPTO_LOCK_SSL_CERT == type)
fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
CRYPTO_thread_id(),
mode,file,line);
*/
if (mode & CRYPTO_LOCK)
{
pthread_mutex_lock(&(lock_cs[type]));
lock_count[type]++;
}
else
{
pthread_mutex_unlock(&(lock_cs[type]));
}
}
unsigned long pthreads_thread_id(void)
{
unsigned long ret;
ret=(unsigned long)pthread_self();
return(ret);
}
Please Let me know, If you can suggest me some thing.
Thank you.
Brajesh
On 4/24/07, Darryl Miles <[EMAIL PROTECTED]> wrote:
brajesh tiwari wrote:
> Can some one please tell me what may be the problem here.
> Thank you very much.
I think the problem may be a bug in your program.
HTH
PS - How do you seriously expect help in debugging your program from a
mailing list. Yes, it is valid for your application code to call
SSL_free(). Other than that there is nothing the list can really gleem
from your stack trace.
You make a point of saying your program is multi-threaded, do you
correctly initialize the thread locking within OpenSSL on application
startup ?
Darryl
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]