classification
Title: Less code under lock in sched.scheduler
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: giampaolo.rodola, pitrou, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2012-12-08 09:33 by serhiy.storchaka, last changed 2012-12-29 19:57 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
sched_less_lock.patch serhiy.storchaka, 2012-12-08 09:33 review
Messages (8)
msg177147 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-08 09:33
In additional to issue16165 I think that sched.scheduler runs more code under a lock than needed. The proposed patch moves this code outside a lock. This unlikely a bug, may be only small enhancement and cleanup.
msg178334 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-27 21:00
If no one objects I will commit this next year.
msg178360 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2012-12-28 04:51
Patch looks fine to me.
msg178386 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-12-28 15:05
What is the point of having heapq.heappush under a lock if heapq.heappop in another method is not protected? The logic doesn't seem to make sense.
msg178405 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-28 18:00
This heapq.heappop does applied to a copy of self._queue. Copying done under a lock.
msg178410 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-12-28 18:14
Ah, ok. By the way, the queue property says it returns "An ordered list", but it seems to actually return an iterator.
msg178411 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-28 18:22
Perhaps it was inherited from Python 2.
msg178526 - (view) Author: Roundup Robot (python-dev) Date: 2012-12-29 19:48
New changeset 1bed43c0a5af by Serhiy Storchaka in branch 'default':
Issue #16640: Run less code under a lock in sched module.
http://hg.python.org/cpython/rev/1bed43c0a5af
History
Date User Action Args
2012-12-29 19:57:18serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2012-12-29 19:48:56python-devsetnosy: + python-dev
messages: + msg178526
2012-12-28 18:22:57serhiy.storchakasetmessages: + msg178411
2012-12-28 18:14:59pitrousetmessages: + msg178410
2012-12-28 18:00:44serhiy.storchakasetmessages: + msg178405
2012-12-28 15:05:55pitrousetmessages: + msg178386
2012-12-28 04:51:01giampaolo.rodolasetmessages: + msg178360
2012-12-27 21:00:37serhiy.storchakasetassignee: serhiy.storchaka
messages: + msg178334
2012-12-08 09:33:59serhiy.storchakacreate