Safe Asynchronous Functions (was: Re: std.concurrency: Returning from spawned function )

dsimcha dsimcha at yahoo.com
Sat Sep 11 15:14:25 PDT 2010


== Quote from Sean Kelly (sean at invisibleduck.org)'s article
> dsimcha Wrote:
> >
> > I don't know the details of how TLS is implemented.  Would it be possible to reset
> > all TLS data for a given thread?
> Definitely for some platforms, possibly for all of them (perhaps requiring some
trickery).  Look at thread_entryPoint in core.thread for a clue on how TLS is
implemented.

Interesting.  Now that I've given it more thought, though, using this is probably
a bad idea for lightweight task-based concurrency because resetting TLS at all
properly would require re-running thread-local module c'tors (arbitrarily
expensive), not just blitting a few things (cheap).  I guess I'll have to resort
to disallowing arbitrary indirection in return types in any safe subset of
std.parallelism.


More information about the Digitalmars-d mailing list