Skip to content

Add mmtk_collection_in_progress C API#313

Open
topolarity wants to merge 1 commit into
mmtk:masterfrom
topolarity:ct/collect-in-progress
Open

Add mmtk_collection_in_progress C API#313
topolarity wants to merge 1 commit into
mmtk:masterfrom
topolarity:ct/collect-in-progress

Conversation

@topolarity

@topolarity topolarity commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This API seems sufficient for Julia to implement a "disable-GC-and-wait-for-finish" API, e.g.:

JL_DLLEXPORT void jl_gc_wait_until_disabled(jl_ptls_t ptls)
{
    while (mmtk_collection_in_progress()) {
        mmtk_gc_poll(ptls);
        jl_cpu_pause();
    }
}

Effectively spinlocking on this condition is not great, but I am OK with cleaning that up in a future re-factor.

I'd also be fine to implement #301 or another re-factor instead.

The only trouble is that those APIs seem to focus on disabling GC triggers or disabling GC stop-the-world, which is not sufficient for true GC-must-not-run critical sections. This API is intended to be used if you want to disable new GC and are willing to wait for ongoing GC to finish to make sure it is not running at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant