Skip to content

Commit 9d03efb

Browse files
committed
Update _PyGCThreadPool doc comment for condvar dispatch
The struct comment still described the old barrier-based dispatch (mark_barrier/done_barrier broadcast). Those fields were retired by the FTP dispatch refactor (7d81e3c); update the comment to match what the struct actually contains: per-worker (wake_mutex, wake_cond) for dispatch + pool-level (done_mutex, done_cond, workers_done_count) for completion signalling, with phase_barrier resized per dispatch for use inside work functions. Trailing cleanup item from the post-NBS audit. No code change; the struct fields themselves were removed in the dispatch refactor. Verified: builds clean and full parallel-GC test suite still green (GIL: 124 tests OK; FTP previously verified at 177 OK).
1 parent 7d81e3c commit 9d03efb

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

Include/internal/pycore_gc_ft_parallel.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,14 @@ typedef struct {
316316
// Persistent thread pool for parallel GC
317317
// Created once on gc.enable_parallel(), destroyed on gc.disable_parallel()
318318
//
319-
// Uses barrier synchronization like the GIL-based parallel GC:
320-
// - mark_barrier: Workers wait here until main signals work ready
321-
// - done_barrier: All workers (including main as worker 0) wait here when done
322-
// - phase_barrier: For multi-phase operations (e.g., UPDATE_REFS init/compute)
319+
// Dispatch uses per-worker condvars (wake_mutex/wake_cond on
320+
// _PyGCWorkerState) so main can wake only the active adaptive_workers
321+
// subset; idle workers stay asleep. Worker completions are signalled
322+
// through the pool's done_mutex/done_cond + workers_done_count.
323323
//
324-
// This guarantees correct termination: barriers only release when ALL
325-
// participants arrive, ensuring no work is in flight.
324+
// phase_barrier remains for use INSIDE work functions (e.g. update_refs
325+
// has init/compute phases); it is resized to adaptive_workers per
326+
// dispatch so it only waits for active participants.
326327
typedef struct _PyGCThreadPool {
327328
// Interpreter state - needed to create Python thread states for workers
328329
PyInterpreterState *interp;

0 commit comments

Comments
 (0)