Avoid popping while another entity is iterating

To avoid 'dictionary changed size during iteration' style
of errors ensure that we acquire the job lock/condition
before popping so that we do not affect another entity that
is currently iterating over the job dictionary.

Change-Id: I353cb7289c84c06f9712391e84294bed513dca78
Merge "Avoid popping while another entity is iterating"