[plt-scheme] change the parameter value for a thread other than the current-thread?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri May 8 05:48:11 EDT 2009

At Fri, 8 May 2009 01:50:19 -0700, YC wrote:
> how can one change the value of a parameter in a thread other than the
> current thread?

It's not possible to access or change a parameter value for a given
thread outside of the thread.

That's by design, so that a library function that uses parameters does
not have to defend against parameter values being leaked or changed
through other threads while the library function is running.

> I gathered that parameter is based off of thread-cell, but it's unclear how
> the underlying thread cell of the parameter can be referenced (and how the
> thread cell can be accessed if I have the pointer to the thread).

You can only get to it by running in the thread.


If the relevant parameter is not built-in, then you could use
continuation marks and boxes to create a parameter-like construct that
can be inspected and modified by other threads.



Posted on the users mailing list.