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

> On Jul 10, 2014, at 12:57 PM, Damien Kick <dkick@stripped> wrote:
>
>> Details follow: am I doing anything obviously wrong?
>
> […]
>
> What I don’t see are any calls to thread_start(), […]

struct Thread_guard {
    Thread_guard() { mysqlpp::Connection::thread_start(); }
    ~Thread_guard() { mysqlpp::Connection::thread_end(); }
};

void my::work(
    mysqlpp::Connection& cxn)
{
    my::Thread_guard thread_guard;
    assert(cxn.thread_aware());
    assert(mysqlpp::Connection::thread_aware());
    for (auto n = 0; n < 100; ++n) {
        auto query = cxn.query("SET @ignore_me = 0");
        query.exec();
    }
}


> […] use of ConnectionPool, […]

I didn't think that was required; is it required?

> or — best of all, IMHO — binding of Connection objects to individual
> threads.

I don't know what that means "bind of Connection objects to individual threads".  There is
no use of the word bind in the threads document that I can find.  The closest I can guess
to what you might mean would be something like using pthread_setaffinity_np to "bind" a
thread using a Connection object to a certain processor.  Could you explain, please?

________________________________

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