• Jason Madden's avatar
    Rework the way Semaphore handles cross-thread locking. · e3667c71
    Jason Madden authored
    This should ultimately be far more robust, and it handles LoopExit cases much better.
    
    Fixes #1698
    
    Not yet complete; On Python 2, I sometimes get ValueError: over-released the semaphore for reasons I don't understand.
    
    Also, Python 2 in general, and PyPy in particular, sometimes fails to make progress on the semaphore tests (one of the background threads doesn't complete for some reason). The RLock tests are much worse on Python 2 also. I don't understand why. Then again, I don't understand how the normal RLock could possibly actually be thread safe either: I think it must lean heavily on the GIL.
    e3667c71
exceptions.py 3.35 KB