Message183810
I don't think you need slicing if you rewrite the patch in another way, e.g.:
for i in range(n):
try:
waiter = __waiters.popleft()
except IndexError:
break
waiter.release()
I think this is safe, since notify() must be called with the lock held: another thread shouldn't be able to mutate the waiters list in the meantime.
As for notify_all(), it could be optimized to swap the internal list with an empty one: there's no need to pop the waiters one by one. |
|
Date |
User |
Action |
Args |
2013-03-09 11:30:16 | pitrou | set | recipients:
+ pitrou, rhettinger, neologix |
2013-03-09 11:30:16 | pitrou | set | messageid: <1362828616.74.0.550498126072.issue17385@psf.upfronthosting.co.za> |
2013-03-09 11:30:16 | pitrou | link | issue17385 messages |
2013-03-09 11:30:16 | pitrou | create | |
|