Prevent running jobs unless a lock is held.

This allows for multiple scheduling processes to run concurrently, but
only one of them will run jobs at any given time.