base: Detect multi-thread use of mutate effect, add container.Ring_Buffer#7030
Open
base: Detect multi-thread use of mutate effect, add container.Ring_Buffer#7030
container.Ring_Buffer#7030Conversation
…uffer` `mutate` now detects if it is used by multiple threads and flags an error (precondition safety fault) if that happens. Added `mutate.exclusive` as a mechanism that may later be used for something like a `synchronized` block or a transaction in a transactional-memory implementation of `mutate`. Added `container.Ring_Buffer`, a simple generic ring buffer implementation that I use as a test case for the work on multi-threaded `mutate` impementations. Added `tests/ring_buf` that tests `container.Ring_Buffer`, but that also should become a test of multi-threaded mutate effects once they are available. I had to add `concur.threads.env.current` to access the current thread to be able to detect that a `mutate` effect is used by several different threads.
Added workaround to permit default instance of `mutate` to be created during the big bang singularity before `concur.threads` effect is instated. Added `racy_mutate` as a workaround to just ignore multi-threading for now until we have proper thread-safe versions of `mutate`. Removed uses of `mutate.env` in `http.fum`. Use `racy_mutate` for local mutate in `webserver.fum` for now. Use `racy_mutate` for local mutate in tests `effect_wormholes` and `mod_webserver` for now. Fixed mutate name output in tests `local_mutate` and `reg_issues3352`. Removed dummy call `_ := lm.env` in test `reg_issue6882`, updated error output.
[skip ci]
…only Changed `mutate` to `racy_mutate` and updated err output.
[skip ci]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mutatenow detects if it is used by multiple threads and flags an error (precondition safety fault) if that happens. Addedmutate.exclusiveas a mechanism that may later be used for something like asynchronizedblock or a transaction in a transactional-memory implementation ofmutate.Added
container.Ring_Buffer, a simple generic ring buffer implementation that I use as a test case for the work on multi-threadedmutateimpementations.Added
tests/ring_bufthat testscontainer.Ring_Buffer, but that also should become a test of multi-threaded mutate effects once they are available.I had to add
concur.threads.env.currentto access the current thread to be able to detect that amutateeffect is used by several different threads.Added
racy_mutateas a temporary workaround to be used where amutateis required by several threads. Added its use in tests that required this.Remove use of
mutateormutinhttp.fumandwebserver.fum, used the mutate provided as a type parameter instead.