summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_pymem.h
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-06-08 20:06:54 (GMT)
committerGitHub <noreply@github.com>2023-06-08 20:06:54 (GMT)
commit68dfa496278aa21585eb4654d5f7ef13ef76cb50 (patch)
tree3a3cd54110d87512915634682f18818577c57ffe /Include/internal/pycore_pymem.h
parent4ff5690e591b7d11cf11e34bf61004e2ea58ab3c (diff)
downloadcpython-68dfa496278aa21585eb4654d5f7ef13ef76cb50.zip
cpython-68dfa496278aa21585eb4654d5f7ef13ef76cb50.tar.gz
cpython-68dfa496278aa21585eb4654d5f7ef13ef76cb50.tar.bz2
gh-100227: Lock Around Modification of the Global Allocators State (gh-105516)
The risk of a race with this state is relatively low, but we play it safe anyway. We do avoid using the lock in performance-sensitive cases where the risk of a race is very, very low.
Diffstat (limited to 'Include/internal/pycore_pymem.h')
-rw-r--r--Include/internal/pycore_pymem.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Include/internal/pycore_pymem.h b/Include/internal/pycore_pymem.h
index a555f37..81a707a 100644
--- a/Include/internal/pycore_pymem.h
+++ b/Include/internal/pycore_pymem.h
@@ -18,6 +18,7 @@ typedef struct {
} debug_alloc_api_t;
struct _pymem_allocators {
+ PyThread_type_lock mutex;
struct {
PyMemAllocatorEx raw;
PyMemAllocatorEx mem;