Lefteris Tsintjelis <[EMAIL PROTECTED]> wrote on 10/07/2005 03:00:29 PM:

> 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

You are probably right. However I am on Win32 and because Win32 doesn't 
use PTHREADs, I will have to protect myself in other ways.  If I ever do 
any development with PTHREADs I will remember this.

Thanks again!

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to