[M3devel] thread local storage, but in C pieces of runtime... (jay, tony?)

Rodney M. Bates rodney_bates at lcwb.coop
Sat May 11 19:58:19 CEST 2013


It would be so much more elegant and Modula-3-like to just add to interface Thread:

PROCEDURE SelfClosure(): Closure;

that returns the closure used in creating the executing thread, similar to the existing Self.
Then you can put your thread-local data in a subtype of Closure, and access it anywhere, using
SelfClosure().Whatever.

Or, maybe just put a reference to the Closure in the Thread.T, and use Self().closure.

We can already do thread local stuff now, within the current language, by putting it
in a subtype of the Closure and accessing this as the Self formal of the apply override
procedure.  Or just make it local variable(s) of the apply override.  The big
inconvenience here is that you have to pass it as a parameter all over the place.

Even that can sometimes be circumvented by making called procedures that access it
local to the apply override, but that won't work if you need to have thread-local
access from something in a separate module.


On 05/10/2013 04:20 PM, Dragiša Durić wrote:
> My only mention of ABI was related to TLS implementation, and maybe for pointer alignment on platform… No POSIX there :).
>
>
> On May 10, 2013, at 10:47 PM, Jay K wrote:
>
>> Dragisa, do you mean to say that Posix describes an ABI? It does not.
>




More information about the M3devel mailing list