Skip to content

base: Detect multi-thread use of mutate effect, add container.Ring_Buffer#7030

Open
fridis wants to merge 7 commits intomainfrom
base_thread_aware_mutate
Open

base: Detect multi-thread use of mutate effect, add container.Ring_Buffer#7030
fridis wants to merge 7 commits intomainfrom
base_thread_aware_mutate

Conversation

@fridis
Copy link
Copy Markdown
Member

@fridis fridis commented Apr 30, 2026

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 racy_mutate as a temporary workaround to be used where a mutate is required by several threads. Added its use in tests that required this.

Remove use of mutate or mut in http.fum and webserver.fum, used the mutate provided as a type parameter instead.

fridis added 7 commits April 30, 2026 17:44
…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.
…only

Changed `mutate` to `racy_mutate` and updated err output.
@fridis fridis marked this pull request as ready for review May 1, 2026 19:28
@fridis fridis requested a review from a team May 1, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant