SE450: Scenario with Locks [26/36] Previous pageContentsNext page

  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 pageContentsNext page