concept multithreade code in category c++

This is an excerpt from Manning's book C++ Concurrency in Action, Second Edition.
Just as with any programming project, it’s vital to think carefully about the design of concurrent code. But with multithreaded code, there are even more factors to consider than with sequential code. Not only must you think about the usual factors, such as encapsulation, coupling, and cohesion (which are amply described in the many books on software design), but you also need to consider which data to share, how to synchronize accesses to that data, which threads need to wait for which other threads to complete certain operations, and so on.
Testing multithreaded code is difficult, so you want to do what you can to make it easier. One of the most important things you can do is design the code for testability. A lot has been written about designing single-threaded code for testability, and much of the advice still applies. In general, code is easier to test if the following factors apply:
As I’ve already mentioned, when reviewing multithreaded code to check for concurrency-related bugs, it’s important to review it thoroughly. If possible, get someone else to review it. Because they haven’t written the code, they’ll have to think through how it works, and this will help to uncover any bugs that may be there. It’s important that the reviewer have the time to do the review properly—not a casual two-minute quick glance, but a proper, considered review. Most concurrency bugs require more than a quick glance to spot—they usually rely on subtle timing issues to manifest.