Throw exception if getWork detected a race condition

Fixes #41.