List:MySQL++« Previous MessageNext Message »
From:Damien Kick Date:July 11 2014 4:54pm
Subject:Re: Problem with attempt to share a Connection between threads
View as plain text  
On Jul 10, 2014, at 10:17 PM, Warren Young
<mysqlpp@stripped<mailto:mysqlpp@stripped>>
 wrote:

On Jul 10, 2014, at 8:32 PM, Damien Kick
<dkick@stripped<mailto:dkick@stripped>> wrote:

I don't know what that means "bind of Connection objects to individual threads”.

It means that at the top of each thread worker, create the connection in that thread, and
never use the connection outside that thread, nor pass any MySQL++ objects it creates
outside that thread.  You can pass copies of the *data* you get from the DB outside the
thread.

<http://youtu.be/ri3aL8At44I?t=1m25s>

Yes, if I use a Connection per thread, then I avoid any threading issues associated with
sharing a Connection between threads.

"The simple fix is to just create a separarate Connection object for each thread that
needs to make database queries."
[<http://tangentsoft.net/mysql++/doc/html/userman/threads.html>]

But I was under the impression that sharing a Connection object between threads should be
okay.

"If your program’s connection-management strategy allows a thread to use a
Connection object that another thread created, you need to know
aboutConnection::thread_start(). This function sets up per-thread resources needed to
make MySQL server calls." [ibid]

(Assume I know nothing […])

Fair enough.  Anybody else?

________________________________

This e-mail and any attachments are confidential. If it is not intended for you, please
notify the sender, and please erase and ignore the contents.

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