More cleanup and refactoring:
- Get rid of _lock() and _unlock(); _lock() is inlined, and so is _unlock(), after factoring out some common code at the end of tpc_begin() and tpc_end(). - In the refactored _unlock() code, only call self.timeout.end() if self.locked was actually set. In the TimeoutThread class: - Add some comments. - Add some assertions. - Get rid of the stop() method; we're a daemon thread so we'll be killed anyway; close_server() is only used from the test suite. - Switch from using a lock + an event to a condition variable. Be religious about doing stuff only while holding the lock. - Inline the timeout() function; it shouldn't reacquire the lock anyway. --Guido & Jeremy
Showing
Please register or sign in to comment