-
Notifications
You must be signed in to change notification settings - Fork 288
PR: Wrap Document classes inside an Agent to handle concurrent writes and reads #798
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
Conversation
|
I don't know if this is an improvement. You seem to have added a busy-while-loop. Study condition objects to remove that busy-while-loop. That said, why not put access to documents, and mutation of documents, under a simple https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/clangd/DraftStore.h |
|
@rwols We didn't took Locks on this one, as handling them may lead to deadlocks or livelocks. The implementation here is equivalent to actors and processes, as they are implemented on Erlang. We use a queue as a mailbox to send a message and then wait for the response, this way, we ensure that no process gets a deadlock |
|
If you ensure a lock is only used from within the methods of a class like a DraftStore, and you make sure that class doesn't call its own methods, then I don't know how one would cause a deadlock. |
|
Actually, acquiring a lock is equivalent in some sort of sense to wait for a message to arrive. Also, by using Actors, we don't have shared state anymore, this any other process cannot modify values directly without passing through the actor. Coming from the Erlang world, it seems more reasonable to use Actors and messages for handling concurrency, rather than locks or semaphores |
All I see is an extra |
|
I can only give advice. I don't have the time to delve into more open-source codebases. I fear that the unnecessary complexity will not make pyls easier to maintain. But you are of course free to merge this. |
|
@andfoy, please solve the merge conflicts in this PR. |
Fixes #793