Here's another race condition. If, right at this point, a new job is added to the waitlist, it will be cleared and never get executed.