Skip to content

[GR-78917] Use reference queue signal thread. - #1124

Merged
graalvmbot merged 6 commits into
masterfrom
fa/GR-78917/refq_signaling_thread
Sep 3, 2026
Merged

[GR-78917] Use reference queue signal thread.#1124
graalvmbot merged 6 commits into
masterfrom
fa/GR-78917/refq_signaling_thread

Conversation

@graalvmbot

Copy link
Copy Markdown
Collaborator

Introduces a watcher thread for the reference queue and signals the main thread that references are available for draining.

Previously, the main thread tried to poll the reference queue way too often. When running workloads with a lot of C API transitions, the main thread would try to poll the refq even more often that the GC would run. Further, polling means that a lock needs to be acquired which can rather be costly.

The approach in this PR is to have a separate thread that watches the refq and as soon as one is available, it would signal that to the main thread which then does the full draining.
The goal is that the main thread just needs to do one (volatile) read for that on the fast path.

If async actions are disabled, we still need to do the full draining on the main thread.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Sep 3, 2026
@graalvmbot
graalvmbot merged commit ae6bcf1 into master Sep 3, 2026
11 checks passed
@graalvmbot
graalvmbot deleted the fa/GR-78917/refq_signaling_thread branch September 3, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants