Fix #704 by going back to pure-python version of Semaphore on PyPy.
The main stated reason for untraceable locks was a bug in Python 2.5, fixed in all recent versions, so that shouldn't be a concern. The semaphore takes some careful lock management to come close to duplicating the thread-safety inherent in Cython's compiled methods. 'pypy -m timeit -s "import g.l.Semaphore; s=Semaphore()"' 's.acquire();s.releas()': With Cython compiled semaphore: 5usec With pure-python sempahore: 0.004usec With pure-python-but-locked semaphore: 0.178usec Cython on CPython: 0.141usec Total test runtime is unchanged.
Showing
Please register or sign in to comment