List:MySQL++« Previous MessageNext Message »
From:Chris Frey Date:July 13 2014 3:27pm
Subject:Re: Problem with attempt to share a Connection between threads
View as plain text  
On Thu, Jul 10, 2014 at 06:57:03PM +0000, Damien Kick wrote:
> namespace my {
> struct Thread_guard {
>     Thread_guard() { mysqlpp::Connection::thread_start(); }
>     ~Thread_guard() { mysqlpp::Connection::thread_end(); }
> };
> 

As far as I can see, in your examples, you either call both start and end,
or you don't call either.

When you do call them, you call end before the connection is gone.

According to a comment here:
http://dev.mysql.com/doc/refman/5.0/en/mysql-thread-init.html
that might not be a good idea.

So, in both your shared connection and conn-per-thread examples, try calling
thread_start() but not end.

Just a guess.

- Chris

Thread
Problem with attempt to share a Connection between threadsDamien Kick10 Jul 2014
  • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
    • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
      • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
        • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
          • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
            • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
              • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
                • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
              • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
                • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
                  • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014
                    • Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
                      • Re: Problem with attempt to share a Connection between threadsAdrian Cornish11 Jul 2014
  • Re: Problem with attempt to share a Connection between threadsChris Frey13 Jul 2014
Re: Problem with attempt to share a Connection between threadsDamien Kick11 Jul 2014
  • Re: Problem with attempt to share a Connection between threadsWarren Young11 Jul 2014