TLF = thread local functions

Frustrated c1514843 at drdrb.com
Thu Jan 23 08:15:45 PST 2014


On Thursday, 23 January 2014 at 14:49:11 UTC, Dicebot wrote:
> On Thursday, 23 January 2014 at 14:44:01 UTC, Frustrated wrote:
>> Functions generally are not thread safe because of reentry,
>> right?
>
> No. They are not thread safe because they use shared data 
> (explicitly/implicitly). Functions that only use thread-local 
> data are always thread-safe.

Um, duh, but in d data is already TLS.

The point is that making the **STACK** TLS too should a way
around having to use synchronization.

Precisely because the STACK is not TLS makes functions not thread
safe(since data is already "safe" in d).


A strongly pure thread local function would never have any
threading issues what so ever. Hence, no synchronization would be
required and they would be very fast(just an extra instruction or
two to fix up the stack if the thread id can be quickly known).





More information about the Digitalmars-d-learn mailing list