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
First implementation bits (long-running PR) #7
Conversation
0fb14bf
to
dc5caa9
Compare
Anyone interested to review this, I'd appreciate a review of the |
06e5613
to
a8c6f5c
Compare
For now, this library re-uses the `CQueue` module (and its dependencies) from the `distributed-process` library, since the latter doesn't build with recent versions of some dependencies. The code is imported from revision 7b8cbf59cc7f291a524a5c of the upstream repository. See: https://github.com/haskell-distributed/distributed-process.git See: https://raw.githubusercontent.com/haskell-distributed/distributed-process/7b8cbf59cc7f291a524a5c405d514e48e6544182/src/Control/Distributed/Process/Internal/CQueue.hs See: https://raw.githubusercontent.com/haskell-distributed/distributed-process/7b8cbf59cc7f291a524a5c405d514e48e6544182/src/Control/Distributed/Process/Internal/StrictList.hs See: https://raw.githubusercontent.com/haskell-distributed/distributed-process/7b8cbf59cc7f291a524a5c405d514e48e6544182/src/Control/Distributed/Process/Internal/StrictMVar.hs
Ignore both `ormolu` formatting, as well as `hlint`. See: cf2d0f2
Expose the vendored modules from `distributed-process` as an internal library. See: cf2d0f2
While working on some other code, it appeared there's a bug with `spawnLink`. However, after adding this test-case, it doesn't appear to be the case (so further debugging in the other branch is required). Keeping the test-case around doesn't harm, though.
When a process is both linked to as well as monitoring some other process, we want to make sure any exception is propagated through the link before a `Down` message can be observed by said process after which it could, e.g., exit successfully, in case its monitor thread did not (yet) observe the signal to inject. This can be achieved by ensuring there are no pending signals at the end of the `receiveWithOptions` implementation, before delivering any matched message to the caller. This patch includes a test-case which, before the fix, exposes the issue (though this is a bug in concurrency, so it may succeed once in a while). With the fix in place it should now succeed consistently. Fixes: #25 See: #25
troupe: add thread affinity to SpawnOptions
@TristanCacqueray With #21 merged here, any chance you could approve this one so it can go in This doesn't imply the current design/implementation is "right", happy to look into various improvements/changes/... to evolve the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't reviewed it all, but that looks good to me for merging.
Excellent, thank you, I'll give HEAD a try in a test project. |
Some code dropping. Not necessarily the way we want things to be.
(CQueue
, taken fromdistributed-process
, is quite complicated. We may want to make this pure STM.CQueue
: rework implementation #11)Rework(CQueue
s "timeout" support using STM'sregisterDelay
.CQueue
: useregisterDelay
#12)MonadProcess
which exposes some somewhat-high-level actions. However, these can be reimplemented by makingMonadProcess
more low-level. Basically, we'll want a way to retrieve the currentProcessContext
, and some otherMaybe ProcessContext
based on aProcessId
(in STM). With those in place (and maybe some others), we can implementsendWithOptions
,spawnWithOptions
etc. outside of the class.spawnImpl
Fixes: #25