FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-39877: _PyRuntimeState.finalizing becomes atomic by vstinner · Pull Request #18816 · python/cpython · GitHub

/ cpython Public

bpo-39877: _PyRuntimeState.finalizing becomes atomic - #18816

Merged
vstinner merged 2 commits into
python:masterfrom
vstinner:atomic_finalizing
Mar 6, 2020
Merged

bpo-39877: _PyRuntimeState.finalizing becomes atomic#18816
vstinner merged 2 commits into
python:masterfrom
vstinner:atomic_finalizing

Conversation

vstinner commented Mar 6, 2020
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

Convert _PyRuntimeState.finalizing field to an atomic variable:

  • Rename it to _finalizing
  • Change its type to _Py_atomic_address
  • Add _PyRuntimeState_GetFinalizing() and _PyRuntimeState_SetFinalizing()
    functions
  • Remove _Py_CURRENTLY_FINALIZING() function: replace it with testing
    directly _PyRuntimeState_GetFinalizing() value

Convert _PyRuntimeState_GetThreadState() to static inline function.

https://bugs.python.org/issue39877

Convert _PyRuntimeState.finalizing field to an atomic variable:

* Rename it to _finalizing
* Change its type to _Py_atomic_address
* Add _PyRuntimeState_GetFinalizing() and _PyRuntimeState_SetFinalizing()
  functions
* Remove _Py_CURRENTLY_FINALIZING() function: replace it with testing
  directly _PyRuntimeState_GetFinalizing() value

Convert _PyRuntimeState_GetThreadState() to static inline function.

vstinner commented Mar 6, 2020

Copy link
Copy Markdown
Member Author

This PR prepares the code for PR #18811 which does no longer protect _PyRuntimeState.finalizing with the GIL. See discussion: #18811 (comment)

pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, but need to fix that pesky MSVC failure.

Comment thread Include/internal/pycore_pystate.h Outdated

static inline void
_PyRuntimeState_SetFinalizing(_PyRuntimeState *runtime, PyThreadState *tstate) {
return _Py_atomic_store_relaxed(&runtime->_finalizing, (uintptr_t)tstate);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think the return is confusing MSVC (see CI failures).

vstinner merged commit 7b3c252 into python:master Mar 6, 2020
vstinner deleted the atomic_finalizing branch March 6, 2020 23:24
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL