-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-29603 New Queue.unfinished() method #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Example of usage this new method can be seen here: https://github.com/slytomcat/cpython/commit/ea313986d86c083e81624fbc8a7ab6a75784e15d |
I'm closing it after discussion in http://bugs.python.org/issue29603 |
akruis
pushed a commit
to akruis/cpython
that referenced
this pull request
Dec 29, 2018
…code Refactor the finalisation code of stackless.tasklet and stackless.channel. - For tasklets, use a PEP 442 finalizer; - for channels a simple tp_clear function is sufficient. Like every PEP 442 other finalizer, the new finalizer runs only once for each tasklet.
akruis
pushed a commit
to akruis/cpython
that referenced
this pull request
Dec 29, 2018
In order to prevent an endless loop in the tasklet-finalizer, try at most 10 times to kill a tasklet.
akruis
pushed a commit
to akruis/cpython
that referenced
this pull request
Dec 29, 2018
Move the handling of tasklets with non-trivial C-state from tasklet_traverse to tasklet_finalize. If a tasklet still has a non-trivial C-state after killing the tasklet, the finalizer appends the tasklet to gc.garbage. Now de-allocation caused by ref-counting behaves identically to de-allocation caused by GC. The gc-patch introduced by stackless-dev/stackless_historic@35ba34f18 is now obsolete.
akruis
pushed a commit
to akruis/cpython
that referenced
this pull request
Dec 29, 2018
Revert the patch, that added the function PyObject_GC_Collectable(). It was introduced by stackless-dev/stackless_historic@35ba34f18. See bpo-9141 for a discussion of this interesting patch.
akruis
pushed a commit
to akruis/cpython
that referenced
this pull request
Jan 12, 2019
…code Refactor the finalisation code of stackless.tasklet and stackless.channel. - For tasklets, use a PEP 442 finalizer; - for channels a simple tp_clear function is sufficient. Like every PEP 442 other finalizer, the new finalizer runs only once for each tasklet.
akruis
pushed a commit
to akruis/cpython
that referenced
this pull request
Jan 12, 2019
In order to prevent an endless loop in the tasklet-finalizer, try at most 10 times to kill a tasklet.
akruis
pushed a commit
to akruis/cpython
that referenced
this pull request
Jan 12, 2019
Move the handling of tasklets with non-trivial C-state from tasklet_traverse to tasklet_finalize. If a tasklet still has a non-trivial C-state after killing the tasklet, the finalizer appends the tasklet to gc.garbage. Now de-allocation caused by ref-counting behaves identically to de-allocation caused by GC. The gc-patch introduced by stackless-dev/stackless_historic@35ba34f18 is now obsolete.
akruis
pushed a commit
to akruis/cpython
that referenced
this pull request
Jan 12, 2019
Revert the patch, that added the function PyObject_GC_Collectable(). It was introduced by stackless-dev/stackless_historic@35ba34f18. See bpo-9141 for a discussion of this interesting patch.
jaraco
pushed a commit
that referenced
this pull request
Dec 2, 2022
Ensure we're sending in a string instead of a list.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Class queue.Queue control the number of unfinished tasks via method task_done(). But it is only possible to get the information about all task done (via join() method).
I'm sure that exposing the number of unfinished tasks (unfinished_tasks class variable) can be very useful in many situations when you need more control over the process.
But it is not good idea to provide write access to this internal variable (as it controls internal queue class status). Better way - provide RO access via class method like qsize or empty. It can be look like this:
One example of this method usage: there is not optimal function _adjust_thread_count in concurrent.futures.ThreadPoolExecutor with following comment:
It can be easily done with following condition:
http://bugs.python.org/issue29603