thread-safe code in c++
Posted on 2016-08-16
I was asked to make a calculator code thread-safe. The program is written in c++ and the IDE is Visual studio 2012.
I created a web application that references the c++ dll in order to test this. Using Curl i can send multiple requests to the web app at the same time.
Initially before I made any changes to the calculator I was getting a mix of results (numbers) when sending multiple requests. After making some changes now the numbers look correct when doing multiple requests, but there is a section in the answer that contain messages and that section is still coming incorrect. The messages from one request seem to show in another request and vice versa.
The Calculator is made up of several C++ classes. The changes I made so far were to remove some static variables I found in some functions. I cannot find any more static variables.
Can anyone give some suggestions of what else I should be looking for to make this code thread-safe?