Thread Synchronization

As stated before, threads can be scheduled to run at any time and in any order. It often is necessary to coordinate various threads and to share resources among threads. One word of initial caution: All multithread applications work in debug mode; it's only in release mode when things start to go haywire. Debugging multithreaded applications takes time and experience; nothing else seems to help make life any easier when dealing with these multi-headed monsters. For some unknown and unexplainable reason, thread scheduling in Debug mode in no way represents the types of scheduling found in Release mode. Mainly, this is a side effect introduced by the debugging environment.

lock Keyword

C# has the lock keyword. lock can be ...

Get C# and the .NET Framework: The C++ Perspective now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.