gh-110481: Implement inter-thread queue for biased reference counting by colesbury · Pull Request #114824 · python/cpython

@colesbury

ericsnowcurrently

@colesbury

@colesbury

colesbury

@colesbury

ericsnowcurrently

@colesbury

Revert back to Py_DECREF() instead of the Py_SET_REFCNT(dict, 0) and fix
check that this thread owns the only reference to the dict. That ensures
that the final Py_DECREF call immediately frees the dict instead of
possibly enqueuing it to be merged.

@colesbury

corona10

@colesbury

@colesbury

@colesbury colesbury deleted the gh-110481-inter-thread-queue branch

February 9, 2024 22:09

fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request

Feb 14, 2024
…unting (python#114824)

Biased reference counting maintains two refcount fields in each object:
`ob_ref_local` and `ob_ref_shared`. The true refcount is the sum of these two
fields. In some cases, when refcounting operations are split across threads,
the ob_ref_shared field can be negative (although the total refcount must be
at least zero). In this case, the thread that decremented the refcount
requests that the owning thread give up ownership and merge the refcount
fields.