diff options
Diffstat (limited to 'Python/gc_free_threading.c')
-rw-r--r-- | Python/gc_free_threading.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/gc_free_threading.c b/Python/gc_free_threading.c index f1ba5de5170..757e9cb3227 100644 --- a/Python/gc_free_threading.c +++ b/Python/gc_free_threading.c @@ -2074,10 +2074,9 @@ gc_should_collect_mem_usage(GCState *gcstate) // clear the young object count so we don't check memory usage again // on the next call to gc_should_collect(). PyMutex_Lock(&gcstate->mutex); + int young_count = _Py_atomic_exchange_int(&gcstate->young.count, 0); _Py_atomic_store_ssize_relaxed(&gcstate->deferred_count, - gcstate->deferred_count + - gcstate->young.count); - _Py_atomic_store_int(&gcstate->young.count, 0); + gcstate->deferred_count + young_count); PyMutex_Unlock(&gcstate->mutex); return false; } |