previous | start | next

## Scenario with Locks

1. First thread calls `add` and acquires lock, then executes
   `elements[tail] = anObject;`
2. Second thread calls `add` and tries to acquire lock, but it is blocked
3. First thread executes
   `tail++;`
4. First thread completes `add`, releases lock
5. Second thread unblocked
6. Second thread acquires lock, starts executing protected code

previous | start | next