views:

22

answers:

1

I have a client server application with multi-threading. The server side is failing with a std::list getting corrupted resulting in a SEGV. I suspect that there is some kind of cross thread timing issue going on where the two threads are updating the std::list at the same time and causing it to be corrupted.

Please suggest free tools to track this down or strategies that might be helpful.

A: 

If you know the shared data structure that is being corrupted due to concurrent access, then put a Mutex on the Data Structure so that only one Thread can access at a a time, then try again.

You need to make sure that no shared data can be updated by concurrent threads. It is OK for multiple threads to read, You do need to be careful of multiple threads reading and one or more writing.

Can you specify what OS you are using and which compiler ?

Romain Hippeau
I have a mutex lock in place, that is why I am confused as to why the corruption is occurring. Something is not behaving as I think it is, and thus I'd like help from a tool to track it down.I am using g++ v3.4.6 and Centos 4.
WilliamKF