GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-104341: Clean Up threading Module by ericsnowcurrently · Pull Request #104552 · python/cpython

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented May 16, 2023

Copy link
Copy Markdown
Member

To fix gh-104341, we need to change the threading module to utilize two locks for each thread: one for if it running (for join()) and one for its overall lifetime, on which Py_EndInterpreter() will wait. This PR cleans things up to make it easier to make that change. As part of that, we move all the module's state out of PyThreadState and PyInterpreterState.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ericsnowcurrently added 12 commits May 15, 2023 14:23
@ericsnowcurrently
Drop bootstate.interp and bootstate.runtime.
b3474f3
@ericsnowcurrently
Add module-owned threads to module state.
ec9f53b
@ericsnowcurrently
Call on_delete() in remove_module_thread().
05aa205
@ericsnowcurrently
Drop interp.threads.count.
da85eed
@ericsnowcurrently
Pass module_state to newlockobject().
004589b
@ericsnowcurrently
Create the thread lock in threading.py.
aa4d3bb
@ericsnowcurrently
Re-initialize the module threads lock upon fork.
82ff2ba
@ericsnowcurrently
Add module_thread.running_lock.
a19c684
@ericsnowcurrently
Be more specific in _wait_for_tstate_lock().
de530b1
@ericsnowcurrently
Fix _set_sentinel().
e2c7058
@ericsnowcurrently
Track the "main" thread too.
0d30811
@ericsnowcurrently
Drop tstate->on_delete.
86e5d82
@ericsnowcurrently ericsnowcurrently added the skip news label May 16, 2023
@bedevere-bot bedevere-bot added the awaiting core review label May 16, 2023
@bedevere-bot bedevere-bot mentioned this pull request May 16, 2023
test__xxsubinterpreters is Occasionally Crashing #104341
Closed
Eclips4
Eclips4 reviewed May 16, 2023
View reviewed changes
Comment thread Modules/_threadmodule.c
static int
module_threads_reinit(struct module_threads *threads)
{
if (_PyThread_at_fork_reinit(threads->mutex) < 0) {

@Eclips4 Eclips4 May 16, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Seems that you're forgot to define a HAVE_FORK, isn't it?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ericsnowcurrently reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@ericsnowcurrently

ericsnowcurrently commented May 16, 2023

Copy link
Copy Markdown
Member Author

I'm going to abandon this for now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ericsnowcurrently ericsnowcurrently closed this May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Eclips4 Eclips4 Eclips4 left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting core review skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

test__xxsubinterpreters is Occasionally Crashing

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ericsnowcurrently @Eclips4 @bedevere-bot
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.