10 messages in com.mysql.lists.win32Re: How thread-safe is mysql_real_con...
FromSent OnAttachments
SGr...@unimin.com07 Oct 2005 09:00 
Mark Papadakis07 Oct 2005 09:33 
SGr...@unimin.com07 Oct 2005 10:02 
John McCaskey07 Oct 2005 10:31 
SGr...@unimin.com07 Oct 2005 11:02 
Lefteris Tsintjelis07 Oct 2005 12:00 
SGr...@unimin.com07 Oct 2005 12:04 
Jeremiah Gowdy11 Oct 2005 00:08 
SGr...@unimin.com11 Oct 2005 06:52 
John McCaskey11 Oct 2005 08:10 
Subject:Re: How thread-safe is mysql_real_connect()?
From:Lefteris Tsintjelis (lef@ene.asda.gr)
Date:10/07/2005 12:00:07 PM
List:com.mysql.lists.win32

John McCaskey wrote:

void *mysql_thread(void *arg) {

mysql_thread_init();

pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,&cancelstate);

//regular mysql code and whatever else here //use mysql_real_connect and mysql_real_query //and whatever without worrying about thread safety

pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,&cancelstate)

mysql_thread_end(); }

Shouldn't this be like that? I have had random core dumps without the setcancelstate recently in case of database failures and back tracing it was really messy. Actually, the setcancelstate should be around any IO routines to and from the database (mysql_real_ query, mysql_real_connect) within your threads.

Lefteris