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

Dragiša Durić dragisha at m3w.org
Sun May 12 08:23:11 CEST 2013


Modula-3 does cover semantic of "local storage" by design. Be it "global" to thread, or whatever, we have means for it and use  it all the time.

Problem we were discussing is related to low-level primitives/applications, going beyond (or under?) Modula-3. We must have a line there, a point where we stop implementing in Modula-3 and start assuming some platform behavior. At least until someone invents more advanced hardware where mutual exclusion, thread local storage etc. are basic building elements done in an elegant way, and replaces all current platforms with this new one :).

I have a "liking" for .i3 wrapping, but Jay is right there. Set of platforms I am working on is small (4) and big portability issues are rare. If we want total (or almost total) portability, we must think beyond Modula-3 bottom line and implement some things in a portable way and closer to machine, and C in its "universal assembly" role does fit a bill.

On May 11, 2013, at 7:58 PM, Rodney M. Bates wrote:

> 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