msg153956 - (view) |
Author: Richard Oudkerk (sbt) *  |
Date: 2012-02-22 15:01 |
multiprocessing.Condition is missing a counterpart for the wait_for() method added to threading.Condition in Python 3.2. I will work on a patch. |
|
|
msg154063 - (view) |
Author: Richard Oudkerk (sbt) *  |
Date: 2012-02-23 13:41 |
Patch which just copies the implementation from threading. |
|
|
msg154093 - (view) |
Author: Charles-François Natali (neologix) *  |
Date: 2012-02-23 22:06 |
In test/test_multiprocessing.py: """ def test_waitfor(self): [...] with cond: result = cond.wait_for(lambda : state.value==0) self.assertTrue(result) self.assertEqual(state.value, 0) for i in range(4): time.sleep(0.01) with cond: state.value += 1 cond.notify() """ Shouldn't the `for` loop be outside the outer `with` block? In Lib/multiprocessing/managers.py: Is there a good reason why the wait_for() proxy method can't simply be implemented as: return self._callmethod('wait_for', (predicate, timeout))? (There may be, I just didn't check). Finally, the documentation should be updated (Doc/library/multiprocessing.rst). Otherwise, it would probably be better if you could submit a contributor agreement (and also maybe update your name on the tracker), unless that's a problem for you? |
|
|
msg154135 - (view) |
Author: Richard Oudkerk (sbt) *  |
Date: 2012-02-24 13:26 |
> Shouldn't the `for` loop be outside the outer `with` block? Yes. > In Lib/multiprocessing/managers.py: > Is there a good reason why the wait_for() proxy method can't simply be > implemented as: > return self._callmethod('wait_for', (predicate, timeout))? > > (There may be, I just didn't check). That would only work if predicate is picklable, which is unlikely to be the case. (The lambda functions used in the unit tests are not picklable.) > Finally, the documentation should be updated > (Doc/library/multiprocessing.rst). Fixed in new patch. > Otherwise, it would probably be better if you could submit a contributor > agreement (and also maybe update your name on the tracker), unless that's > a problem for you? I will try to submit it over the weekend. |
|
|
msg157244 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2012-03-31 23:54 |
AFAICT (Raw)Value relies on ctypes, so the tests should be skipped if ctypes is unavailable. Or I guess you could use a Semaphore instead. |
|
|
msg157762 - (view) |
Author: Richard Oudkerk (sbt) *  |
Date: 2012-04-07 22:36 |
New patch skips tests if ctypes not available. |
|
|
msg158459 - (view) |
Author: Richard Oudkerk (sbt) *  |
Date: 2012-04-16 14:42 |
New patch which calculates endtime outside loop. |
|
|
msg158497 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2012-04-16 20:16 |
Charles-François, will you take this one? :) |
|
|
msg158533 - (view) |
Author: Charles-François Natali (neologix) *  |
Date: 2012-04-17 07:32 |
> Charles-François, will you take this one? :) Yes :-) |
|
|
msg158557 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2012-04-17 16:46 |
New changeset 5606ee052783 by Charles-François Natali in branch 'default': Issue #14087: multiprocessing: add Condition.wait_for(). Patch by sbt. http://hg.python.org/cpython/rev/5606ee052783 |
|
|
msg158559 - (view) |
Author: Charles-François Natali (neologix) *  |
Date: 2012-04-17 17:30 |
Committed. Thanks for the patch, and sorry for the delay! |
|
|