Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make read and write access to modified properties synchronized #568

Merged
merged 1 commit into from
May 2, 2022

Conversation

ahus1
Copy link
Contributor

@ahus1 ahus1 commented Apr 30, 2022

When working on the other PR, I found that the reset via the AWT thread and the blocking by the background thread are not synchronized and not volatile. This could result in a situation that one thread sets some information that is then not visible for another thread. This PR changes that - please let me know if I chose the right means.

… is both access from background and foreground threads.

Only synchronization assures that the changes are visible immediately.
@jshiell jshiell merged commit ea32e9e into jshiell:main May 2, 2022
@jshiell
Copy link
Owner

jshiell commented May 2, 2022

Good spot, thanks - as to the means, it's brute-force, but for what we're doing it's a simple and maintainable solution, and so a good choice for this!

TBH the codebase will be full of this sort of thing - some of the code dates back to 2006, when I somehow knew even less about building software, and when the threading model for IDEA plugins was very, very different. JetBrains have done sterling work in making the IDE more responsive since then, but it has lead to a lot of the code being called in a very different manner than it was designed for. TL;DR mea culpa 😬

@ahus1 ahus1 deleted the blocked-until-now-volatile branch May 7, 2022 11:44
@ahus1
Copy link
Contributor Author

ahus1 commented May 7, 2022

@jshiell - this is no place for a "mea culpa"!

I'm happy that this plugin exists, and I'm happy to lend a helping hand when I can. With the plugin I maintain (the AsciiDoc plugin) I often find myself in a similar spot that the evolving JetBrains APIs are a challenge now and then (including the multithreading).

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