Skip to content

Commit

Permalink
Add high-level comment about index pools
Browse files Browse the repository at this point in the history
  • Loading branch information
mpage committed Sep 25, 2024
1 parent 2f11cc7 commit 04f1ac3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Include/internal/pycore_index_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ extern "C" {

#ifdef Py_GIL_DISABLED

// This contains code for allocating unique indices in an array. It is used by
// the free-threaded build to assign each thread a globally unique index into
// each code object's thread-local bytecode array.

// A min-heap of indices
typedef struct _PyIndexHeap {
Py_ssize_t *values;

Expand All @@ -23,6 +28,8 @@ typedef struct _PyIndexHeap {
Py_ssize_t capacity;
} _PyIndexHeap;

// An unbounded pool of indices. Indices are allocated starting from 0. They
// may be released back to the pool once they are no longer in use.
typedef struct _PyIndexPool {
PyMutex mutex;

Expand Down

0 comments on commit 04f1ac3

Please sign in to comment.