There are lots of places like this where it would be better to use the `with self._thread_lock` context manager; that will really reduce a lot of potential for bugs.