List:General Discussion« Previous MessageNext Message »
From:Eric Bergen Date:July 1 2004 1:06am
Subject:Re: threading problems in linux C client
View as plain text  
If you have multiple threads accessing the same connection remember to
make sure that only one thread enters mysql_query() mysql_connect() or
mysql_store_result() after you store the result another thread will be
able to use that connection without problems.


On Wed, 30 Jun 2004 11:01:35 +0000, darren <teodarren@stripped> wrote:
> Hi all,
> I am writing a multi-threaded client that requires shared access to a single MySQL
> connection. The environment is Redhat 7.3 with the patched mysql-3.23.58-2.71.i386.rpm
> installed and compiled with -l libmysqlclient_r.
> The connection is made from the main thread and a MYSQL_RES* myres declared from the
> child thread is used to fetch results back to the thread. I get a Segmentation fault the
> first instance my child thread (only one) accesses MYSQL_RES through
> mysql_num_rows(myres). (gdb informed me that this is due to  mysql_num_rows from
> I have read a few docs about writing MySQL multi-threaded clients and have called
> my_init() in my main prog and my_thread_init() at the first line of my thread handler.
> Any ideas?
> --
> MySQL General Mailing List
> For list archives:
> To unsubscribe:
threading problems in linux C clientdarren30 Jun
  • Re: threading problems in linux C clientEric Bergen1 Jul