previous |
start |
next
Scenario with Synchronized Methods
- First thread calls add and executes
elements[tail] =
anObject;
- First thread at end of time slice
- Second thread tries to call add, blocks
- First thread executes
tail++;
- First thread completes add, unlocks queue
- Second thread unblocked
- Second thread calls add
previous |
start |
next