multi-threaded swapvaluation.cpp
Posted by
jlee on
Feb 12, 2014; 12:10am
URL: http://quantlib.414.s1.nabble.com/multi-threaded-swapvaluation-cpp-tp14958.html
Hi,
I am trying to calculate fair swap rate and using swapvaluation.cpp from the Examples. If I call the fairRate() method several times in a loop it works fine. But when I call it using threads I get random errors. I don't think it's actually the fairRate() method but part of the creation of the Swap object.
I have attached an example from my bigger program but it reproduces the error. It's in MSVC++ 2013 and when you start the program, it prompts you for the number of threads to use. Usually if you use 10 you'll get the error, definitely if you use 20 threads. If you use only 1 thread, it loops several times and no errors occur.
Hope this helps as it took awhile to isolate but I've reached the limit of my technical skills in debugging it. If you need any more information let me know.
ql_test.rar