January 2003
Intermediate to advanced
896 pages
19h 58m
English
In the output of the CreatingThreads.cs example, two threads write to the screen using Console.WriteLine. At no point does the output from the two threads get mixed up on the screen. This is because the Console.WriteLine method is thread safe: you can safely call it from more than one thread in a process and know that the critical part in the method where the method actually performs the write operation cannot be entered by more than one thread at a time. If it could, the output of the two threads could be mixed up on the screen.
Thread safety is a very important issue in multithreaded development, and the causes of thread safety problems are often very subtle. Thread safety problems aren’t always easy to ...
Read now
Unlock full access