Async or event library

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 6 03:42:41 PDT 2016


On Thursday, 5 May 2016 at 08:19:26 UTC, chmike wrote:
> At the bottom of the wiki page there is an innocent question 
> regarding TLS which is quite devastating. A worker thread pool 
> system would not support affinity between threads and callback 
> context. Unfortunately, D relies on Thread Local Storage for 
> semi global data. This would be error prone. I saw such error 
> case with people using TLS with Corba.

You can declare global data with shared qualifier:

int data; //TLS
shared int data; //global

On Thursday, 5 May 2016 at 08:28:36 UTC, chmike wrote:
> I would like to add that the switchable TLS is only a half 
> backed solution. It would't work in a multi core context where 
> threads are truly executing in parallel. Two such threads might 
> get the same TLS context which would invalidate its implicit 
> predicate.

If TLS doesn't work, it's a bug in TLS implementation. I don't 
think such bug exists. AFAIK TLS works fine on multicore systems.


More information about the Digitalmars-d-learn mailing list