eclipse-langium / langium

Next-gen language engineering / DSL framework
https://langium.org/
MIT License
754 stars 68 forks source link

Add read queue to workspace mutex #1291

Closed msujew closed 11 months ago

msujew commented 1 year ago

Right now, the workspace mutex is only able to lock on write operations - any read operation will abort the current write operation. We want to extend the mutex to allow to perform a read operation (or multiple ones in parallel) after finishing all queued write operations.

This could also resolve the issue experienced in https://github.com/eclipse-langium/langium/discussions/1290, since it's probably related to an LSP service trying to resolve a cross reference during the build process.

spoenemann commented 1 year ago

We already had a read-write lock in a previous PR: https://github.com/eclipse-langium/langium/pull/549/commits/56966f6cdf13ab33a03daec10895d30f8eaaaa12#diff-095a6181fde780365fcff35aa085c4b5aff0ec9e081d26f716bd29bca6575974

We decided to reduce it to a simple mutex because we wanted to keep things simple. At that time, I didn't see the case where a language developer adds a custom operation that needs read access at a point in time where the document is in a clean state. We could revive that old code now.