Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add thread-local storage for POSIX-y platforms.


On Sat, 06 Oct 2018 14:30:36 -0700, iriri <iri@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> key to be used with `settls(k, v)` and `gettls(k)`. (One concern with
> the latter two functions is that they effectively take and return
> untyped pointers, 

Yeah. I think that's acceptable, but I wonder if we can play tricks to
get typed keys.

	type tlskey(@a) = int32
	const tlsalloc	: (-> tlskey(@a))
	const tlsget	: (k : tlskey(@a)# -> @a#)

It'll still let you get the wrong thing, but at least it adds a veneer
of type safety.

-- 
    Ori Bernstein

Follow-Ups:
[PATCH] Add thread-local storage for POSIX-y platforms.iriri <iri@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References:
[PATCH] Add thread-local storage for POSIX-y platforms.iriri <iri@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
[PATCH] Add thread-local storage for POSIX-y platforms.iriri <iri@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>