previous |
start |
next
Solving the Race Condition Problem
- A thread must be able to lock an object temporarily
- When a thread has the object locked, no other thread can modify
the state of the object.
- In Java, use synchronized methods to do this
- Tag all methods that contain thread-sensitive code with the
keyword synchronized
previous |
start |
next