Is MS CHESS out of date?

I have a class that works with a string dictionary. One way is to initialize the dictionary, another to add a new pair to the dictionary, and a third method to combine the dictionary into a string.

I would like to execute unit-test, if it is thread safe, by running add-add-add - * -add-add methods to different threads at the same time. Before use, a new instance of the class is created; the dictionary is not static. Therefore, I would like to know for sure if it is safe.

Afaik, testing threads in unit tests is not a good idea. Instead, I found CHESS that was designed for exactly the same purpose: http://blog.decarufel.net/2009/05/how-to-test-your-multi-threaded-code.html

However, it looks like it is out of date. Any modern alternatives / suggestions for this field?

+5
source share
2 answers

Alternatively, you can take a look at using the ConcurrentDictionary type , which will abstract these specific multithreading issues.

, ( , ), , . - - , , , , .

+3

All Articles