When you check for undone work before acquiring a lock that ensures you are the only one actually doing the work, you have to redo the check *after* acquiring said lock. Otherwise, there is room for nasty random race condition issues...
When you check for undone work before acquiring a lock that ensures you are the only one actually doing the work, you have to redo the check *after* acquiring said lock. Otherwise, there is room for nasty random race condition issues...