mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-111924: Use PyMutex for Runtime-global Locks. (gh-112207)
This replaces some usages of PyThread_type_lock with PyMutex, which does not require memory allocation to initialize. This simplifies some of the runtime initialization and is also one step towards avoiding changing the default raw memory allocator during initialize/finalization, which can be non-thread-safe in some circumstances.
This commit is contained in:
parent
db460735af
commit
cf6110ba13
18 changed files with 97 additions and 241 deletions
|
@ -8,6 +8,7 @@ extern "C" {
|
|||
# error "this header requires Py_BUILD_CORE define"
|
||||
#endif
|
||||
|
||||
#include "pycore_lock.h" // PyMutex
|
||||
#include "pycore_pyerrors.h"
|
||||
|
||||
|
||||
|
@ -128,7 +129,7 @@ struct _xidregitem {
|
|||
struct _xidregistry {
|
||||
int global; /* builtin types or heap types */
|
||||
int initialized;
|
||||
PyThread_type_lock mutex;
|
||||
PyMutex mutex;
|
||||
struct _xidregitem *head;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue