O'Reilly logo

Quality Code: Software Testing Principles, Practices, and Patterns by Stephen Vance

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Race Conditions

Threads bring us a higher likelihood of bugs because they can access shared data without explicit coordination, whereas IPC mechanisms required significant forethought to apply. In fact, the complexity of writing code that behaves properly in threads warrants its own term. Code is thread-safe if it guarantees correctness when running in multiple threads simultaneously.

Most threading bugs are race conditions. Generally speaking, race conditions occur when data writes are not properly coordinated. There are three types of race conditions based on the conflicting operation and its order: write-read, read-write, and write-write.

If asynchronous operations that have ordering dependencies are not properly coordinated, you have a

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required