Making multiple service calls
If you’re considering using multiple threads to speed up a calculation, then I recommend that you get the code tested and working with a single thread before taking on the additional complexity of multiple threads.
For the service we’re working on, the reason to add a second thread is not to increase the speed of anything. We need to avoid a timeout for a calculation that might take a long time. The additional thread we’re going to add is not designed to make the calculation any faster. Once we get the calculation working with one additional thread, we can consider adding more threads to speed up the calculation.
The need to create a thread to do some work while the original thread continues with something else is common. This is not an optimization that should be done later. This is part of the design and the additional thread should be included from the very beginning.
Let’s begin by adding a new test to Message.cpp...