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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.