Message171975
Attached is a new version of Kristjan's patch with support for managers. (A threading._RWLockCore object is proxied and wrapped in a local instance of a subclass of threading.RWLock.)
Also I made multiprocessing.RWLock.__init__() use multiprocessing.util.register_after_fork() to clear self._owners. Otherwise on Unix you can run into trouble if a forked processes starts a new thread whose id was in self._owners at the time of the fork.
I found that test_many_readers() and test_recursion() tended to fail when run with processes (on Windows). This is because starting a process on Windows is slow, particularly with a debug build. (Some of the buildbots running Windows in a VM can be crazily slow.) Each reader only held the lock for 0.02 secs which is much less than the time to start a process on Windows. This meant that it was easy to never have overlapping ownership, causing the tests to fail.
I fixed this by starting the readers while holding an exclusive, waiting for period, and then releasing the exclusive lock. This makes it possible to change
self.assertTrue(max(nlocked) > 1)
to
self.assertEqual(max(nlocked), N)
Choosing timeouts to keep the buildbots happy can be a pain:-( |
|
Date |
User |
Action |
Args |
2012-10-04 16:56:00 | sbt | set | recipients:
+ sbt, pitrou, kristjan.jonsson, christian.heimes, jyasskin, asvetlov, neologix, mklauber, Sebastian.Noack |
2012-10-04 16:55:59 | sbt | set | messageid: <1349369759.38.0.440142405873.issue8800@psf.upfronthosting.co.za> |
2012-10-04 16:55:59 | sbt | link | issue8800 messages |
2012-10-04 16:55:58 | sbt | create | |
|