GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — gh-129185: Use PyMutex in tracemalloc by vstinner · Pull Request #129246 · python/cpython Conversation
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| #define tables_lock _PyRuntime.tracemalloc.tables_lock | ||
| #define TABLES_LOCK() PyThread_acquire_lock(tables_lock, 1) | ||
| #define TABLES_UNLOCK() PyThread_release_lock(tables_lock) | ||
| #define TABLES_LOCK() PyMutex_LockFlags(&tables_lock, _Py_LOCK_DONT_DETACH) |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
PyMutex_Lock(&tables_lock) cannot be used "free" allocator hooks which don't acquire the GIL.
Maybe PyMutex_Lock(&tables_lock) should be preferred in functions which hold the GIL?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't think it matters. TABLES_LOCK() didn't detach the thread state before, no need to now. (In fact, some unpredictable things might happen if another thread takes the GIL and then uses tracemalloc.)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. We should also consider using _Py_atomic for some fields (especially tracing).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.