On Wed, Sep 21, 2016 at 4:53 PM, <bran...@barclay.org> wrote:

> ;; Why does the mutation of a simple global in a thread become visible to
> the main thread, but the mutation of global parameter does not?
> In general, parameters are designed to be per-thread rather than shared.
If they weren't, the parameter wouldn't reliably maintain its value
throughout the dynamic scope of a parameterize form.  So when you attempt
to mutate a parameter from another thread, you are mutating a copy.

Specifically, a parameter that has been bound with parameterize is always
per-thread. As you can see by looking at SRFI 39's rationale, unbound
parameters can behave differently in different implementations.  Chicken
chooses to make them per-thread in all cases: parameters are just elements
of a hidden vector that is copied when a new thread is forked (which means
it's expensive to have millions of parameter objects).
Chicken-users mailing list

Reply via email to