dbTalk Databases Forums  

Does MySQL++ Lib needs to be recompiled with -pthread for Multithreading?

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Does MySQL++ Lib needs to be recompiled with -pthread for Multithreading? in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ankur G35 Saxena
 
Posts: n/a

Default Does MySQL++ Lib needs to be recompiled with -pthread for Multithreading? - 09-16-2006 , 02:47 AM






------=_Part_25706_6601208.1158392679797
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi I am using MySQL++ extensively in my code and I just made some
modifications which now uses a ton of stl maps and vectors and strings.

When I first did this, my code would core dump and after doing some research
it turns out, that STL is not thread safe and i need to compile my code with
-pthread, so I did and got rid of that problem.

Now I have a different one. It seems like my string memory is getting
corrupted and is happening after the first use of mysql++ lib calls like
connect, checking teh DB etc. I dont think they are directly related, as I
am not doing anything different. This doesnt happen all the time, but when i
print something out of my MAP after a mysqlpp call, some parts of it print
out incorrectly with ctrl chars etc. I havent been able to pin point to
mysqlpp lib, but do you think i need to recompile the code of mysql++ to be
-pthread safe so that my full application becomes pthread safe?

Thanks
Ankur

------=_Part_25706_6601208.1158392679797--

Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: Does MySQL++ Lib needs to be recompiled with -pthread for Multithreading? - 09-18-2006 , 06:50 AM






Ankur G35 Saxena wrote:
Quote:
do you think i need to recompile the code of mysql++ to be
-pthread safe
Absolutely.

Quote:
so that my full application becomes pthread safe?
If you believe that a simple linkage change will make your program
thread-safe you are quite mistaken. Get a book on threads, and read of
the many many ways your program can die, even when all the code is
thread-aware. Ensuring stability in a multithreaded program is highly
nontrivial.

And no, before you ask, MySQL++ is not in any sense thread-safe. All
building it with thread support does is makes it use thread-aware
versions of your system's standard libraries, so that calls down into
those libraries don't crash. See all the mutex/Lock stuff on the
Wishlist for a start. (In particular, read the part of the MySQL
documentation linked to from the Wishlist, which explains the
constraints we must meet.) Until we get that out of the way, blind use
of the library in a multithreaded app is almost guaranteed to cause
problems. And after that, I'm still not prepared to offer a guarantee
that ignorance will go unpunished.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.