I have read through the archives and am still unclear on a few things:

 o Does libmysqlclient_r only correct the timeout problem?  Or does it
   provide thread safe versions of calls like mysql_query()?  I do not
   need to use timeouts.

 o I will definately be using different connections in each thread, as my
   threads do not need to share the results of queries.  (The daemon has
   to be threaded for entirely different reasons.)  Are the only
   limitations then on mysql_real_connect()?

 o Why is it that I have to not only mutex lock my mysql_real_connect()
   calls but wait until they are all finished until I can proceed with any
   queries?

 o I am also still wondering whether the system I described in my original
   email (below) is the best implementation.

I have not had any luck getting anyone to respond to these questions.
If I make any money off of the software I'm developing I would certainly
like to support mysql's development not only to perpetuate a great project
but to receive help with these types of questions (I assure you they are
not sent without much prior work to attempt to answer them myself).  In
the mean time I would greatly appreciate any help.

Thank you,
Kyle Cronan
<[EMAIL PROTECTED]>

---------- Forwarded message ----------
Date: Fri, 5 Jan 2001 11:55:44 +0000 (/etc/localtime)
From: Kyle Cronan <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Thread safe client with C api (repost)

Further work has led me to believe that my understanding of these thread
safety issues may be incorrect.  Any comments?

Kyle

---------- Forwarded message ----------
Date: Wed, 3 Jan 2001 02:24:47 +0000 (/etc/localtime)
From: Kyle Cronan <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Thread safe client with C api

Hello,

I have a daemon for a billing system I've been developing that has three
different threads, all of which need a connection to a mysql server.  From
my reading of the documentation, I can either use different (MYSQL *)
connection handles in each thread, or (if I follow certain restrictions
such as not running queries at the same time) I can use the same
connection.  I am wondering if this is correct.  I really don't care
whether I use the same connection or different ones, except that the
latter approach requires less effort on my part.  Perhaps someone could
enlighten me on the advantages of the other approach.

Also, I have found that Bad Things happen when I run mysql_real_connect at
the same time from different threads (the manual seems to indicate this,
but it is a little unclear to me whether this is only supposed to occur in
the non threads-safe client library).  So I have put in place a mutex
lock to prevent this from happening, and I have also had to use condition
signaling to prevent the threads from continuing with queries until all
three connections have been made.

What I am primarily concerned with: will this implementation be thread safe?
Almost as important: is this the best way to do it?

Thanks for all your help.

Kyle Cronan
<[EMAIL PROTECTED]>





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to