Skip to content

Use volatile read in Folia scheduler task getStateVolatile - #14495

Merged
jpenilla merged 1 commit into
mainfrom
fix/scheduler-state-volatile-read
Nov 18, 2026
Merged

jpenilla merged 1 commit into
mainfrom
fix/scheduler-state-volatile-read

Conversation

@jpenilla

Copy link
Copy Markdown
Member

VarHandle#get performs a plain read even when the underlying field is declared volatile. getStateVolatile in EntityScheduledTask and GlobalScheduledTask now uses getVolatile, matching its name and the existing setStateVolatile, which already uses setVolatile.

VarHandle#get performs a plain read even when the underlying field is
declared volatile. getStateVolatile in EntityScheduledTask and
GlobalScheduledTask now uses getVolatile, matching its name and the
existing setStateVolatile, which already uses setVolatile.
@jpenilla
jpenilla requested a review from a team as a code owner November 17, 2026 17:58
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Nov 17, 2026
jpenilla added a commit to PaperMC/Folia that referenced this pull request Nov 17, 2026
VarHandle#get is a plain read even on volatile fields. Match the
setters and the rest of the codebase by using getVolatile.

The FoliaEntityScheduler/FoliaGlobalRegionScheduler changes are
carried from PaperMC/Paper#14495 until it is merged upstream.
R00tB33rMan added a commit to CraftCanvasMC/Canvas that referenced this pull request Nov 17, 2026
VarHandle#get is a plain read even on volatile fields, so getStateVolatile in the region, entity and global region scheduler tasks and getReferenceCounterVolatile in the region task queue now use getVolatile, matching the setters and compare-and-exchange calls next to them. ThreadedRegion#getCenterSection also read each section's z from its x coordinate rather than its key, sorting sections by x alone.

Port of PaperMC/Folia#534 and PaperMC/Folia@4613c9d, the FoliaEntityScheduler and FoliaGlobalRegionScheduler changes carried from PaperMC/Paper#14495 until it is merged
@papermc-projects papermc-projects Bot moved this from Awaiting review to Full approval in Paper PR Queue Nov 18, 2026
@jpenilla
jpenilla merged commit f7153ca into main Nov 18, 2026
8 checks passed
@jpenilla
jpenilla deleted the fix/scheduler-state-volatile-read branch November 18, 2026 03:45
@github-project-automation github-project-automation Bot moved this from Full approval to Merged in Paper PR Queue Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

2 participants