Skip to content

Use atomic instead of a shared mutex for DFA.s0#3313

Merged
parrt merged 1 commit into
antlr:masterfrom
jcking:go-runtime-thread-safety
Dec 28, 2021
Merged

Use atomic instead of a shared mutex for DFA.s0#3313
parrt merged 1 commit into
antlr:masterfrom
jcking:go-runtime-thread-safety

Conversation

@jcking

@jcking jcking commented Oct 18, 2021

Copy link
Copy Markdown
Collaborator

A shared mutex is kind of heavyweight when we are essentially replicating volatile from Java which is ultimately an atomic load/store. This change switches Go to use the equivalent, atomic.StorePointer and atomic.LoadPointer.

@parrt

parrt commented Dec 28, 2021

Copy link
Copy Markdown
Member

that sounds right to me as we did very little locking in java version. Particularly when all we did was switch a pointer.

@parrt parrt modified the milestones: 4.9, 4.9.4 Dec 28, 2021
@parrt parrt merged commit 8fabd86 into antlr:master Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants