C++ Threads Library for Win32
After reading about Refactoring and Test Driven Development, I have been trying
to refactor and test my code. There have been two problems which make this difficult.
First the code was written before learning about TDD and Refactoring. Second, the
code is multi-threaded.
Very few people seem to be applying these techniques to multi-threaded code. The
people in the yahoo Refactoring and Test Driven Development groups have been very
helpful, including help with my C++ code.
In the process of refactoring, I have created wrapper classes for some of the win32
system calls for working with threads. I have extracted these out of my application,
and added some unit tests. I am posting the code here, hoping that others will find
it useful, and hopefully to get some feedback on how to unit test multi-threaded
code.
This solution in the download was created using Visual Studio .NET 2003. If you
have and older version of Visual C++ or other compiler, delete everything except
the source code and create a new project from scratch.
download the code
If anyone recognizes the code in Test.cpp and Test.h, please let me know, so that
I can give credit where credit is due. I can't remember who the author was and what
magazine it was published in.
References:
Object-Oriented
Multithreading Using C++ by Cameron Hughes and Tracey Hughes
|