Multi thread C++ dll global variable causing crash
===

I have a small C++ dll that has 2 callback functions that retrieve information from another dll.

These 2 callback functions are being called repeatedly in more than 1 thread.

They both add information to the same global Cstring variable.  

I have another function that the program that uses this dll will call that reads this variable.

It is rare, but sometimes I get a crash and its definitely due to this global variable being read/written to at the same time by 2 different functions.

I am not very experienced with multithreads, so I don't really know what to do.

Any suggestions?

here is a previous question I posted about the same problem with a bit more info..(and some of the code).
One of the users assisted me in confirming that it was a multithread issue and we didnt get much further than that.

http://stackoverflow.com/questions/10461206/c-dll-crash-reading-writing-crash-related-i-think