List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:March 5 2009 3:52pm
Subject:Re: Confirmation about thread un-safety/safety
View as plain text  
Jim Wallace wrote:
> I know you can't use the same connection object on different threads.

I don't think that's true, as stated.  What you can't do is use a single 
connection object for two different queries at once.  This issue really 
has nothing to do with threads:

http://tangentsoft.net/mysql++/doc/html/userman/tutorial.html#concurrentqueries

Threads just make it harder to avoid running into this limitation.

> It looks like I can 't do query.store() on one thread and
> query.store_next() on another since it calls
> conn_->driver()->next_result();

Did you try it and find that it fails, or are you just avoiding it 
because you think it won't work?  If the latter, try it anyway.

Obviously due to the simultaneous query issue, you do have to avoid 
making another query on that connection until the second thread has 
finished consuming the results.  If you were hoping to avoid this, 
perhaps so you could have one thread processing results while another 
starts new queries, then you do indeed need at least two Connections.
Thread
Confirmation about thread un-safety/safetyJim Wallace5 Mar
  • Re: Confirmation about thread un-safety/safetyWarren Young5 Mar
    • RE: Confirmation about thread un-safety/safetyJim Wallace5 Mar
      • Re: Confirmation about thread un-safety/safetyWarren Young5 Mar
      • Re: Confirmation about thread un-safety/safetydan g.5 Mar