[plt-dev] thread-specifics [PATCH]
At Tue, 3 Mar 2009 14:39:39 -0500 (EST), Dimitris Vyzovitis wrote:
> On Tue, 3 Mar 2009, Matthew Flatt wrote:
>
> > Is there a reason this needs to be built in, instead of implemented as
> > a weak hash table?
>
> There is no rendezvous needed to access the specific, because it is
> attached to the thread (a public readonly cell), simplifying things with
> barriers, tagging, etc.
There's also no rendezvous for an `eq?'-based weak hash table (which is
the variant suitable for mapping threads to values).
More precisely, the rendezvous is implemented in each case by atomicity
of the core.
> The thread can set a weak table in its specific if for key/value access.
But it's only composable to the degree that everyone who can seet a
thread uses the weak hash table...