H1 2015 Priorities and Bare-Metal Programming

Mike via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 1 20:35:25 PST 2015


On Monday, 2 February 2015 at 01:17:52 UTC, Walter Bright wrote:

> You can use __gshared to not get TLS,

Yes, that is what we are doing.

> and a freestanding implementation doesn't necessarily imply no 
> threads.

Indeed.

There are also interrupt service routines that can be thought of
as short lived threads.  But the overhead of TLS is not
appropriate for an ISR that demands low latency.  `shared`, on
the other hand, might be more appropriate.  Perhaps a compiler
error should be emitted if an ISR attempts to access state not
decorated with `shared`.  But then the language needs some way to
identify ISRs, yes?

> it was far better to always build for multi thread and have a 
> runtime adapt itself for single thread dynamically.

I'm with you, but if the runtime port only supports a single
thread, I don't want to force users of my libraries to have to
decorate their state with __gshared, as it's redundant.  They
should be able to use the idiomatic D they see in D's learning
material.  Perhaps I can solve this in my runtime implementation
and/or linker scripts, but I need to study the implementation
more.

Mike


More information about the Digitalmars-d mailing list