Add DeadlockException

Make it easier to handle deadlocks by throwing a specific exception.