haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.61k stars 351 forks source link

Make workerqueue cancellable if not started already configurable #4297

Open soulomoon opened 2 weeks ago

soulomoon commented 2 weeks ago
          >  it's pretty much identical to having a resource that's guarded by a lock

yes, with a bit different, enqueued actions would not be cancelled even if the thread (enqueue it) is cancelled.

It reminds me of something, we might probably want to limit some of the queue size to 1, so the waiting to enqueue action can be cancelled when we are doing shakeRestart. Then less likely a duplicated action would be run for the sessionLoadQueue But maybe in another PR, we might need to come up with some design, such as we might need a bit wrapping to do over TQueue and TMVar if we do it this way.

Originally posted by @soulomoon in https://github.com/haskell/haskell-language-server/issues/4256#issuecomment-2156089965