Skip to content

Simplify and strengthen namespace-level storage.#520

Open
toddjonker wants to merge 1 commit intoion-fusion:mainfrom
toddjonker:ns-store-threadsafe
Open

Simplify and strengthen namespace-level storage.#520
toddjonker wants to merge 1 commit intoion-fusion:mainfrom
toddjonker:ns-store-threadsafe

Conversation

@toddjonker
Copy link
Copy Markdown
Member

This does two things:

  • Stop pointless lazy allocation that left dangerous edge cases while adding work to every mutation of a namespace variable.
  • Synchronizes all access to the store, so behavior under contention is better behaved. At the very least, we won't corrupt this data structure.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This does two things:
  * Stop pointless lazy allocation that left dangerous edge cases while adding work to every mutation of a namespace variable.
  * Synchronizes all access to the store, so behavior under contention is better behaved.  At the very least, we won't corrupt this data structure.
public final Object lookup(int address)
{
return myValues.get(address);
synchronized (myDefinedValues)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these reads need to be synchronized? Are there cases where lookups will be happening in contention with their address being set? At least to my intuition, the writes would need to be synchronized to ensure addresses are allocated correctly, but once we reach this code path it means an address has been allocated and thus should be safe to read without contention.

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.

2 participants