Add `ThreadException` class and destructor for the `ThreadImpl`.